feat(retry): rewrite withRetry helper for public export and configurability - #658
Merged
Jaydbrown merged 1 commit intoSep 3, 2026
Merged
Conversation
…bility Rewrites the withRetry helper introduced in conduit-protocol#648 so it is actually exported from the public API and is configurable enough for reuse beyond the RPC proxy: - Exports withRetry, WithRetryOptions, and isTransientRpcError from src/index.ts (the previous PR claimed this but omitted the change). - Adds maxDelayMs cap, full/equal jitter strategies, AbortSignal cancellation, a custom shouldRetry predicate, and an onRetry hook. - Preserves default behaviour: retry only RateLimitError, honour Retry-After, and fall back to exponential backoff. - Classifies raw RPC errors with RateLimitError.fromRpcError inside the helper so callers and predicates receive typed errors. - Adds dedicated unit tests in src/tests/with-retry.test.ts. Refs conduit-protocol#648, conduit-protocol#620.
Jaydbrown
added a commit
that referenced
this pull request
Sep 3, 2026
The squash-merge of #658 regressed package-lock.json to a stale state that dropped the standalone node_modules/@emnapi/core and @emnapi/runtime nodes, breaking `npm ci` on CI (npm 10): Missing: @emnapi/core@2.0.0-alpha.3 from lock file Restore the lockfile to its pre-#658 state, which is in sync with the current package.json (that PR did not change package.json).
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.
Summary
Rewrites the withRetry helper introduced in #648 so it is actually exported from the public API and is configurable enough for reuse beyond the internal RPC proxy.
What changed
one / ull / �qual), a custom shouldRetry predicate, AbortSignal cancellation, and an onRetry hook.
Verification
px tsc --noEmit passes.
px eslint src --ext .ts passes.
px vitest run src/tests/with-retry.test.ts src/tests/soroban-retry-after.test.ts src/tests/soroban-rate-limit.test.ts passes (20/20).
References