Skip to content

fix: add a backoff for getBlock on -32004 from upstream#22

Open
notwedtm wants to merge 2 commits intotritonfrom
getblock-backoff-retry
Open

fix: add a backoff for getBlock on -32004 from upstream#22
notwedtm wants to merge 2 commits intotritonfrom
getblock-backoff-retry

Conversation

@notwedtm
Copy link

This pull request refactors the error handling logic for block fetching in the poller.rs file, making it more robust and testable. The main improvement is the introduction of a new error classification system that allows for more granular handling of different block fetch failures, including retry strategies and skipping blocks. Additionally, unit tests have been added to ensure the correctness of the classification logic.

Error handling improvements:

  • Introduced the BlockFetchRetryAction enum and the classify_block_fetch_error function to encapsulate block fetch error handling, allowing for immediate retry, delayed retry with backoff, or skipping blocks based on error codes.
  • Refactored fetch_block_with_infinite_retries to use the new classification system, improving logging, metrics, and retry behavior for different error types.

Testing enhancements:

  • Added unit tests for the classify_block_fetch_error function to verify correct classification of errors and retry actions.

Minor adjustments:

  • Added Duration to imports and removed an unnecessary blank line in pop_cached_blocks_to_index. [1] [2]

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants