feat(stellar): add createHorizonClient with exponential backoff and retry support#155
Open
Marvelg256 wants to merge 1 commit into
Open
feat(stellar): add createHorizonClient with exponential backoff and retry support#155Marvelg256 wants to merge 1 commit into
Marvelg256 wants to merge 1 commit into
Conversation
…etry support Adds a lightweight HTTP client for Stellar Horizon with: - Configurable retry policy (max retries, base/max delay, retryable statuses) - Exponential backoff with jitter - Respects Retry-After header with max delay cap - Retries on network errors (fetch throwing) - Supports GET and POST with URLSearchParams - Custom fetch injection for testing - Per-call retry policy override support - Trailing slash normalization on Horizon URL - TypeScript generics for typed responses Closes wraith-protocol#135
|
@Marvelg256 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! 🚀 |
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
Adds
createHorizonClient— a lightweight, retry-capable HTTP client for Stellar Horizon with exponential backoff, jitter, Retry-After support, and configurable retry policies.Changes
New files
src/chains/stellar/horizon.ts—createHorizonClientfactory with configurable retry policy, exponential backoff with jitter, Retry-After header support, retries on retryable HTTP statuses and network errors, GET/POST support, custom fetch injection, per-call retry override, trailing slash normalization, full TypeScript genericstest/chains/stellar/horizon.test.ts— 18 tests covering all retry scenarios, error types, and edge casesModified files
src/chains/stellar/index.ts— re-exportscreateHorizonClientand typesError handling
Reuses existing
RPCRequestErrorandRPCRetryExhaustedErrorfromsrc/errors.ts.Closes #135