reduce mempool poll rate while indexing

This commit is contained in:
Mononaut 2023-07-31 16:41:36 +09:00
parent bafc0bd9cf
commit 6b7d8d95f7
No known key found for this signature in database
GPG Key ID: A3F058E41374C04E

View File

@ -195,7 +195,8 @@ class Server {
// rerun immediately if we skipped the mempool update, otherwise wait POLL_RATE_MS
const elapsed = Date.now() - start;
const remainingTime = Math.max(0, config.MEMPOOL.POLL_RATE_MS - elapsed)
const pollRate = config.MEMPOOL.POLL_RATE_MS * (indexer.indexerRunning ? 10 : 1);
const remainingTime = Math.max(0, pollRate - elapsed);
setTimeout(this.runMainUpdateLoop.bind(this), numHandledBlocks > 0 ? 0 : remainingTime);
this.backendRetryCount = 0;
} catch (e: any) {