Stop processing after endBlock in watcher fill CLI

This commit is contained in:
Nabarun 2024-06-19 18:05:35 +05:30
parent 115c9de0f0
commit 4d2816e61f

View File

@ -80,12 +80,12 @@ export const fillBlocks = async (
const completePercentage = Math.round(blocksProcessed / numberOfBlocks * 100);
log(`Processed ${blocksProcessed} of ${numberOfBlocks} blocks (${completePercentage}%)`);
await processBlockByNumber(jobQueue, blockNumber + 1);
if (blockNumber + 1 >= endBlock) {
// Break the async loop when blockProgress event is for the endBlock and processing is complete.
if (blockNumber + 1 > endBlock) {
// Break the async loop when next block to be processed is more than endBlock.
break;
}
await processBlockByNumber(jobQueue, blockNumber + 1);
}
}