From 5dc25964e51aba60682e9c80dad73838ab540380 Mon Sep 17 00:00:00 2001 From: Sameer Kumar Subudhi Date: Fri, 26 Jan 2024 17:19:57 +0530 Subject: [PATCH] :wrench: Limit indexing pace to assist in app node performance --- services/blockchain-indexer/config.js | 13 +++++++++++++ .../shared/indexer/blockchainIndex.js | 1 + services/export/config.js | 6 +++++- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/services/blockchain-indexer/config.js b/services/blockchain-indexer/config.js index fc57b117fd..5156822f22 100644 --- a/services/blockchain-indexer/config.js +++ b/services/blockchain-indexer/config.js @@ -103,6 +103,19 @@ config.queue = { name: 'IndexBlocks', concurrency: 1, scheduledJobsMaxCount: Number(process.env.INDEX_BLOCKS_QUEUE_SCHEDULED_JOB_MAX_COUNT) || 100000, + options: { + defaultJobOptions: { + attempts: 5, + timeout: 5 * 60 * 1000, // millisecs + removeOnComplete: true, + removeOnFail: true, + stackTraceLimit: 0, + }, + limiter: { + max: 600, + duration: 1 * 60 * 1000, + }, + }, }, indexAccountPublicKey: { name: 'PendingPublickeyUpdates', diff --git a/services/blockchain-indexer/shared/indexer/blockchainIndex.js b/services/blockchain-indexer/shared/indexer/blockchainIndex.js index cf6f430f16..6ff71df8e1 100644 --- a/services/blockchain-indexer/shared/indexer/blockchainIndex.js +++ b/services/blockchain-indexer/shared/indexer/blockchainIndex.js @@ -699,6 +699,7 @@ const initBlockProcessingQueues = async () => { config.queue.indexBlocks.name, indexBlock, config.queue.indexBlocks.concurrency, + config.queue.indexBlocks.options, ); deleteIndexedBlocksQueue = Queue( diff --git a/services/export/config.js b/services/export/config.js index e91db30385..78f71fec92 100644 --- a/services/export/config.js +++ b/services/export/config.js @@ -82,7 +82,11 @@ config.queue = { options: { defaultJobOptions: { attempts: 5, - timeout: 15 * 60 * 1000, // millisecs + backoff: { + type: 'exponential', + delay: 1 * 60 * 1000, // millisecs + }, + timeout: 5 * 60 * 1000, // millisecs removeOnComplete: true, removeOnFail: true, stackTraceLimit: 0,