Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

Commit

Permalink
⚙️ Limit block indexing
Browse files Browse the repository at this point in the history
  • Loading branch information
sameersubudhi committed Apr 5, 2024
1 parent 02a0e77 commit 949b594
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
18 changes: 12 additions & 6 deletions services/blockchain-indexer/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,18 @@ config.debug = process.env.SERVICE_LOG_LEVEL === 'debug';
* Message queue options
*/
config.queue = {
defaultJobOptions: {
attempts: 5,
timeout: 5 * 60 * 1000, // millisecs
removeOnComplete: true,
removeOnFail: true,
stackTraceLimit: 0,
defaultOptions: {
defaultJobOptions: {
attempts: 5,
timeout: 5 * 60 * 1000, // millisecs
removeOnComplete: true,
removeOnFail: true,
stackTraceLimit: 0,
},
limiter: {
max: 30,
duration: 10 * 1000, // in millisecs
},
},

// Inter-microservice message queues
Expand Down
2 changes: 2 additions & 0 deletions services/blockchain-indexer/shared/indexer/blockchainIndex.js
Original file line number Diff line number Diff line change
Expand Up @@ -699,13 +699,15 @@ const initBlockProcessingQueues = async () => {
config.queue.indexBlocks.name,
indexBlock,
config.queue.indexBlocks.concurrency,
config.queue.defaultOptions,
);

deleteIndexedBlocksQueue = Queue(
config.endpoints.cache,
config.queue.deleteIndexedBlocks.name,
deleteIndexedBlocksWrapper,
config.queue.deleteIndexedBlocks.concurrency,
config.queue.defaultOptions,
);
};

Expand Down
6 changes: 3 additions & 3 deletions services/blockchain-indexer/shared/messageProcessor.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,17 @@ const STATS_INTERVAL = 1 * 60 * 1000; // ms
const accountMessageQueue = new MessageQueue(
config.queue.account.name,
config.endpoints.messageQueue,
{ defaultJobOptions: config.queue.defaultJobOptions },
{ defaultJobOptions: config.queue.defaultOptions.defaultJobOptions },
);

// Missing blocks
const blockMessageQueue = new MessageQueue(config.queue.block.name, config.endpoints.messageQueue, {
defaultJobOptions: config.queue.defaultJobOptions,
defaultJobOptions: config.queue.defaultOptions.defaultJobOptions,
});

// Newly generated blocks
const eventMessageQueue = new MessageQueue(config.queue.event.name, config.endpoints.messageQueue, {
defaultJobOptions: config.queue.defaultJobOptions,
defaultJobOptions: config.queue.defaultOptions.defaultJobOptions,
});

const queueStatus = async messageQueue => {
Expand Down

0 comments on commit 949b594

Please sign in to comment.