Avoid eth_getLogs query if no subgraph event handlers exist
This commit is contained in:
parent
45177bb2ce
commit
f7d2d0941b
@ -651,7 +651,18 @@ 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));
|
||||
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)
|
||||
));
|
||||
}
|
||||
|
||||
const dbTx = await this._db.createTransactionRunner();
|
||||
try {
|
||||
|
@ -657,7 +657,18 @@ 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));
|
||||
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)
|
||||
));
|
||||
}
|
||||
|
||||
const dbTx = await this._db.createTransactionRunner();
|
||||
try {
|
||||
|
@ -1165,7 +1165,18 @@ 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));
|
||||
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)
|
||||
));
|
||||
}
|
||||
|
||||
const dbTx = await this._db.createTransactionRunner();
|
||||
try {
|
||||
|
@ -1040,7 +1040,18 @@ 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));
|
||||
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)
|
||||
));
|
||||
}
|
||||
|
||||
const dbTx = await this._db.createTransactionRunner();
|
||||
try {
|
||||
|
@ -1424,7 +1424,18 @@ 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));
|
||||
let dbEvents: DeepPartial<Event>[] = [];
|
||||
let transactions: EthFullTransaction[] = [];
|
||||
|
||||
// Fetch events 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)
|
||||
));
|
||||
}
|
||||
|
||||
const dbTx = await this._db.createTransactionRunner();
|
||||
try {
|
||||
|
Loading…
Reference in New Issue
Block a user