Skip to content

Commit

Permalink
Remove saveBlockAndFetchEvents method callback pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
nikugogoi authored and prathamesh0 committed Nov 21, 2022
1 parent c1a26ee commit 21e6d93
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/erc20-watcher/src/indexer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ export class Indexer implements IndexerInterface {
}

async saveBlockAndFetchEvents (block: DeepPartial<BlockProgress>): Promise<[BlockProgress, DeepPartial<Event>[]]> {
return this._baseIndexer.saveBlockAndFetchEvents(block, this._saveBlockAndFetchEvents.bind(this));
return this._saveBlockAndFetchEvents(block);
}

async saveBlockProgress (block: DeepPartial<BlockProgress>): Promise<BlockProgress> {
Expand Down
2 changes: 1 addition & 1 deletion packages/uni-info-watcher/src/indexer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ export class Indexer implements IndexerInterface {
}

async saveBlockAndFetchEvents (block: DeepPartial<BlockProgress>): Promise<[BlockProgress, DeepPartial<Event>[]]> {
return this._baseIndexer.saveBlockAndFetchEvents(block, this._saveBlockAndFetchEvents.bind(this));
return this._saveBlockAndFetchEvents(block);
}

async saveBlockProgress (block: DeepPartial<BlockProgress>): Promise<BlockProgress> {
Expand Down
2 changes: 1 addition & 1 deletion packages/uni-watcher/src/indexer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ export class Indexer implements IndexerInterface {

// Note: Some event names might be unknown at this point, as earlier events might not yet be processed.
async saveBlockAndFetchEvents (block: DeepPartial<BlockProgress>): Promise<[BlockProgress, DeepPartial<Event>[]]> {
return this._baseIndexer.saveBlockAndFetchEvents(block, this._saveBlockAndFetchEvents.bind(this));
return this._saveBlockAndFetchEvents(block);
}

async saveBlockProgress (block: DeepPartial<BlockProgress>): Promise<BlockProgress> {
Expand Down
2 changes: 2 additions & 0 deletions packages/util/src/job-runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,9 @@ export class JobRunner {
let events = [];

console.time('time:job-runner#_indexBlock-saveBlockAndFetchEvents');
log(`_indexBlock#saveBlockAndFetchEvents: fetching from upstream server ${blockHash}`);
[blockProgress, events] = await this._indexer.saveBlockAndFetchEvents({ cid, blockHash, blockNumber, parentHash, blockTimestamp });
log(`_indexBlock#saveBlockAndFetchEvents: fetched for block: ${blockProgress.blockHash} num events: ${blockProgress.numEvents}`);
console.timeEnd('time:job-runner#_indexBlock-saveBlockAndFetchEvents');

this._blockAndEventsMap.set(blockHash, { block: blockProgress, events });
Expand Down

0 comments on commit 21e6d93

Please sign in to comment.