feat(indexer): exponential backoff retry on event_type_filter RPC calls - #307
Merged
Conversation
Introduce src/indexer/event_type_filter.ts as a dedicated module that wraps Soroban RPC getEvents with exponential-backoff retry logic for transient connection failures. Changes: - Add EVENT_TYPES constant (single source of truth, removed from poller) - Add isConnectionError() to classify retryable network errors (ECONNREFUSED, ETIMEDOUT, ECONNRESET, fetch failed, socket hang up, etc.) - Add nextBackoff() helper: doubles delay each attempt, caps at 300 000 ms - Add fetchEventsWithRetry(): retries up to MAX_ATTEMPTS (5) on connection errors with 1 s initial backoff doubling each failure; non-connection errors propagate immediately without retrying; sleep is injectable for deterministic testing - Update poller.ts to delegate getEvents to fetchEventsWithRetry so every poll cycle recovers gracefully from RPC connection dropouts - Add __tests__/event-type-filter.test.ts with 53 tests covering: - EVENT_TYPES content - isConnectionError classification (14 error patterns) - nextBackoff doubling and cap behaviour - Retry call counts match maxAttempts exactly on total failure - Sleep delays grow strictly: [1000, 2000, 4000, 8000] for 5 attempts - Immediate abort on non-connection errors - Mixed connection/non-connection error sequences All 730 existing tests continue to pass (42 suites). Closes Goldii-locks#276
|
@eliassmthl-collab Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
Contributor
|
@eliassmthl-collab fix failed CI check and resolve conflict |
…etry-strategies-on-event_type_filter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Introduce src/indexer/event_type_filter.ts as a dedicated module that wraps Soroban RPC getEvents with exponential-backoff retry logic for transient connection failures.
Changes:
All 730 existing tests continue to pass (42 suites).
Closes #276