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(blockHash);
|
||||||
assert(blockNumber);
|
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();
|
const dbTx = await this._db.createTransactionRunner();
|
||||||
try {
|
try {
|
||||||
|
@ -657,7 +657,18 @@ export class Indexer implements IndexerInterface {
|
|||||||
assert(blockHash);
|
assert(blockHash);
|
||||||
assert(blockNumber);
|
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();
|
const dbTx = await this._db.createTransactionRunner();
|
||||||
try {
|
try {
|
||||||
|
@ -1165,7 +1165,18 @@ export class Indexer implements IndexerInterface {
|
|||||||
assert(blockHash);
|
assert(blockHash);
|
||||||
assert(blockNumber);
|
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();
|
const dbTx = await this._db.createTransactionRunner();
|
||||||
try {
|
try {
|
||||||
|
@ -1040,7 +1040,18 @@ export class Indexer implements IndexerInterface {
|
|||||||
assert(blockHash);
|
assert(blockHash);
|
||||||
assert(blockNumber);
|
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();
|
const dbTx = await this._db.createTransactionRunner();
|
||||||
try {
|
try {
|
||||||
|
@ -1424,7 +1424,18 @@ export class Indexer implements IndexerInterface {
|
|||||||
assert(blockHash);
|
assert(blockHash);
|
||||||
assert(blockNumber);
|
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();
|
const dbTx = await this._db.createTransactionRunner();
|
||||||
try {
|
try {
|
||||||
|
Loading…
Reference in New Issue
Block a user