From 9cfee07f47fc506f3a3d32fab301b6fcae9e9513 Mon Sep 17 00:00:00 2001 From: Simon Lindh Date: Fri, 15 Nov 2019 17:27:12 +0800 Subject: [PATCH] Prevent transaction backlog to cause mempool update halts --- backend/src/api/mempool.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/backend/src/api/mempool.ts b/backend/src/api/mempool.ts index 089ce604b..f96ce9ee6 100644 --- a/backend/src/api/mempool.ts +++ b/backend/src/api/mempool.ts @@ -122,6 +122,10 @@ class Mempool { console.log('Error finding transaction in mempool.'); } } + + if ((new Date().getTime()) - start > config.MEMPOOL_REFRESH_RATE_MS * 10) { + break; + } } const newMempool: IMempool = {};