Check for blockHandlerExists first before block processing

This commit is contained in:
Nabarun 2024-06-20 09:56:06 +05:30
parent 817b5eb359
commit 934bebcd38
2 changed files with 4 additions and 3 deletions

View File

@ -125,12 +125,12 @@ export class EventWatcher {
// Perform checks before starting historical block processing // Perform checks before starting historical block processing
if ( if (
// Check if any block handler exists in subgraph config
!this._indexer.graphWatcher?.blockHandlerExists &&
// Check if useBlockRanges is enabled for historical blocks processing // Check if useBlockRanges is enabled for historical blocks processing
this._config.jobQueue.useBlockRanges && this._config.jobQueue.useBlockRanges &&
// Check if starting block for watcher is before latest canonical block // Check if starting block for watcher is before latest canonical block
startBlockNumber < latestCanonicalBlockNumber && startBlockNumber < latestCanonicalBlockNumber
// Check if any block handler exists in subgraph config
!this._indexer.graphWatcher?.blockHandlerExists
) { ) {
await this.startHistoricalBlockProcessing(startBlockNumber, latestCanonicalBlockNumber); await this.startHistoricalBlockProcessing(startBlockNumber, latestCanonicalBlockNumber);

View File

@ -289,6 +289,7 @@ export interface GraphDatabaseInterface {
export interface GraphWatcherInterface { export interface GraphWatcherInterface {
readonly blockHandlerExists: boolean; readonly blockHandlerExists: boolean;
readonly eventHandlerExists: boolean;
init (): Promise<void>; init (): Promise<void>;
setIndexer (indexer: IndexerInterface): void; setIndexer (indexer: IndexerInterface): void;
} }