Skip to content

Conversation

@mfw78
Copy link
Contributor

@mfw78 mfw78 commented Feb 14, 2024

Description

Fixes an issue associated with block processing unexpected errors.

Changes

  • Move metrics to finally
  • Move registry saving to finally

How to test

  1. Observe in staging

@mfw78 mfw78 added the bug Something isn't working label Feb 14, 2024
@mfw78 mfw78 requested a review from anxolin February 14, 2024 19:02
@mfw78 mfw78 self-assigned this Feb 14, 2024
// Block height metric
this.registry.lastProcessedBlock = blockToRegistryBlock(block);
await this.registry.write();
metrics.blockHeight.labels(chainId.toString()).set(blockNumber);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but if the block was not process, why should we write it is.
Wouldn't this cover up next issue we have?

provider.on("block", async (blockNumber: number) => {
// Intentionally don't guard the getBlock call with a try/catch block
// because we want to crash the process if this fails. This will result
// in the kubernetes pod restarting and trying to recover.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i would rephrase and not reference kubernetes here, as this is code that can be run in various ways

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants