Skip to content

Commit

Permalink
chore: make logs less verbose in non-optimistic mode (#294)
Browse files Browse the repository at this point in the history
Previously if optimistic indexing was not enabled every time
block is not found message would be displayed at ERROR level.

This PR prevents it from happening, only single info message
will be emitted.
  • Loading branch information
Sekhmet authored May 10, 2024
1 parent 2531649 commit 3dc25f1
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/checkpoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -372,11 +372,13 @@ export default class Checkpoint {

return this.next(nextBlockNumber);
} catch (err) {
if (this.config.optimistic_indexing && err instanceof BlockNotFoundError) {
try {
await this.networkProvider.processPool(blockNum);
} catch (err) {
this.log.error({ blockNumber: blockNum, err }, 'error occurred during pool processing');
if (err instanceof BlockNotFoundError) {
if (this.config.optimistic_indexing) {
try {
await this.networkProvider.processPool(blockNum);
} catch (err) {
this.log.error({ blockNumber: blockNum, err }, 'error occurred during pool processing');
}
}
} else {
this.log.error({ blockNumber: blockNum, err }, 'error occurred during block processing');
Expand Down

0 comments on commit 3dc25f1

Please sign in to comment.