Wait for events processing to complete before continuing historical blocks processing (#450)

* Wait for events queue to be empty before continuing historical processing

* Make historicalLogsBlockRange and historicalMaxFetchAhead configurable

* Perform single RPC request for multiple addresses
This commit is contained in:
2023-11-06 11:34:48 +05:30
committed by GitHub
parent 546af92638
commit 8a720ef175
10 changed files with 115 additions and 61 deletions
+7 -1
View File
@@ -135,6 +135,12 @@ export class BaseCmd {
// Note: In-memory pubsub works fine for now, as each watcher is a single process anyway.
// Later: https://www.apollographql.com/docs/apollo-server/data/subscriptions/#production-pubsub-libraries
const pubsub = new PubSub();
this._eventWatcher = new EventWatcher(this._config.server, this._clients.ethClient, this._indexer, pubsub, this._jobQueue);
const config = {
server: this._config.server,
jobQueue: this._config.jobQueue
};
this._eventWatcher = new EventWatcher(config, this._clients.ethClient, this._indexer, pubsub, this._jobQueue);
}
}
+1 -1
View File
@@ -108,7 +108,7 @@ export class JobRunnerCmd {
const jobRunner = new JobRunner(config.jobQueue, indexer, jobQueue);
await jobRunner.jobQueue.deleteAllJobs();
await jobRunner.jobQueue.deleteAllJobs('completed');
await jobRunner.resetToPrevIndexedBlock();
await startJobRunner(jobRunner);
+2 -2
View File
@@ -281,8 +281,8 @@ export class ServerCmd {
assert(eventWatcher);
if (config.server.kind === KIND_ACTIVE) {
// Delete jobs to prevent creating jobs after completion of processing previous block.
await jobQueue.deleteAllJobs();
// Delete jobs before completed state to prevent creating jobs after completion of processing previous block.
await jobQueue.deleteAllJobs('completed');
await eventWatcher.start();
}