mirror of
https://github.com/cerc-io/watcher-ts
synced 2025-07-29 11:22:08 +00:00
Codegen changes for avoiding eth_getLogs when no subgraph event handlers exist
This commit is contained in:
parent
4d2816e61f
commit
f63d35b336
@ -10,8 +10,7 @@
|
||||
checkpointInterval = 2000
|
||||
|
||||
# Enable state creation
|
||||
# CAUTION: Disable only if state creation is not desired or can be filled subsequently
|
||||
enableState = true
|
||||
enableState = false
|
||||
|
||||
{{#if (subgraphPath)}}
|
||||
subgraphPath = "./subgraph-build"
|
||||
|
@ -829,6 +829,7 @@ export class Indexer implements IndexerInterface {
|
||||
{{/each}}
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
||||
_populateRelationsMap (): void {
|
||||
{{#each subgraphEntities as | subgraphEntity |}}
|
||||
{{#if subgraphEntity.relations}}
|
||||
@ -867,7 +868,27 @@ export class Indexer implements IndexerInterface {
|
||||
assert(blockHash);
|
||||
assert(blockNumber);
|
||||
|
||||
const { events: dbEvents, transactions } = await this._baseIndexer.fetchEvents(blockHash, blockNumber, this.eventSignaturesMap, this.parseEventNameAndArgs.bind(this));
|
||||
{{#if (subgraphPath)}}
|
||||
let dbEvents: DeepPartial<Event>[] = [];
|
||||
let transactions: EthFullTransaction[] = [];
|
||||
|
||||
// Fetch events and txs only if subgraph config has any event handlers
|
||||
if (this._graphWatcher.eventHandlerExists) {
|
||||
({ events: dbEvents, transactions } = await this._baseIndexer.fetchEvents(
|
||||
blockHash,
|
||||
blockNumber,
|
||||
this.eventSignaturesMap,
|
||||
this.parseEventNameAndArgs.bind(this)
|
||||
));
|
||||
}
|
||||
{{else~}}
|
||||
const { events: dbEvents, transactions } = await this._baseIndexer.fetchEvents(
|
||||
blockHash,
|
||||
blockNumber,
|
||||
this.eventSignaturesMap,
|
||||
this.parseEventNameAndArgs.bind(this)
|
||||
);
|
||||
{{/if}}
|
||||
|
||||
const dbTx = await this._db.createTransactionRunner();
|
||||
try {
|
||||
|
Loading…
Reference in New Issue
Block a user