mirror of
https://github.com/cerc-io/watcher-ts
synced 2025-07-31 20:12:06 +00:00
Stop processing after endBlock in watcher fill CLI
This commit is contained in:
parent
115c9de0f0
commit
4d2816e61f
@ -80,12 +80,12 @@ export const fillBlocks = async (
|
|||||||
const completePercentage = Math.round(blocksProcessed / numberOfBlocks * 100);
|
const completePercentage = Math.round(blocksProcessed / numberOfBlocks * 100);
|
||||||
log(`Processed ${blocksProcessed} of ${numberOfBlocks} blocks (${completePercentage}%)`);
|
log(`Processed ${blocksProcessed} of ${numberOfBlocks} blocks (${completePercentage}%)`);
|
||||||
|
|
||||||
await processBlockByNumber(jobQueue, blockNumber + 1);
|
if (blockNumber + 1 > endBlock) {
|
||||||
|
// Break the async loop when next block to be processed is more than endBlock.
|
||||||
if (blockNumber + 1 >= endBlock) {
|
|
||||||
// Break the async loop when blockProgress event is for the endBlock and processing is complete.
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await processBlockByNumber(jobQueue, blockNumber + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user