Refactor blockProcessingOffset check to switch endpoint on max new block retries

This commit is contained in:
Nabarun 2024-07-03 11:23:47 +05:30
parent 3cd6491305
commit e1abd5f684

View File

@ -158,6 +158,12 @@ export class EventWatcher {
endBlockNumber = Math.floor(endBlockNumber / this._config.jobQueue.historicalLogsBlockRangeEndFactor) * this._config.jobQueue.historicalLogsBlockRangeEndFactor;
}
if (endBlockNumber < startBlockNumber) {
await this.startRealtimeBlockProcessing(startBlockNumber);
return;
}
this._historicalProcessingEndBlockNumber = endBlockNumber;
log(`Starting historical block processing in batches from ${startBlockNumber} up to block ${this._historicalProcessingEndBlockNumber}`);