Use prefetching of blocks with events in watchers and codegen (#206)

* Avoid refetching block while fetching events

* Prefetch a batch of blocks with events while indexing

* Update mock indexer used in graph-node testing

* Process available blocks while prefetching

* Refactor events fetching to a method in util

* Move method to get GQL event query result to util
This commit is contained in:
prathamesh0
2022-10-20 18:46:56 +05:30
committed by GitHub
parent 668875b3a0
commit 306bbb73ca
38 changed files with 436 additions and 1105 deletions
+3 -3
View File
@@ -1,5 +1,5 @@
import assert from 'assert';
import { FindConditions, FindManyOptions } from 'typeorm';
import { DeepPartial, FindConditions, FindManyOptions } from 'typeorm';
import {
IndexerInterface,
@@ -89,8 +89,8 @@ export class Indexer implements IndexerInterface {
return '';
}
async fetchBlockWithEvents (block: BlockProgressInterface): Promise<BlockProgressInterface> {
return block;
async saveBlockAndFetchEvents (block: BlockProgressInterface): Promise<[BlockProgressInterface, DeepPartial<EventInterface>[]]> {
return [block, []];
}
async removeUnknownEvents (block: BlockProgressInterface): Promise<void> {