Repository navigation
feat(rpc): handle rate limiting and Retry-After - #141
Merged
Ayinkx01 merged 1 commit intoOct 28, 2026
Merged
Conversation
Detect HTTP 429 responses in HttpTransport, carry a numeric Retry-After delay on a typed DevkitError::RateLimited, and retry within a configurable cumulative cap (60s by default). Requests that would exceed the cap fail immediately with a clear error instead of sleeping unboundedly. Add mocked and local-server tests plus documentation. Closes StellarFoundry#45
Ayinkx01
approved these changes
Oct 28, 2026
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 distinct handling for RPC rate limits.
HttpTransportdetects HTTP429 Too Many Requestsand returns a typedDevkitError::RateLimitedcarrying the numericRetry-Afterdelay instead of a generic I/O error.Clientretries rate-limit responses only while the requested delay fits inside a configurable cumulative cap (RetryPolicy::max_rate_limit_wait, 60s by default). A missing or non-numericRetry-Afterfalls back to a bounded 1s backoff.rate_limited; the JSON error envelope and exit code are unchanged.Tests
429responses assert retry-then-success and retry exhaustion.HttpTransport429 path andRetry-Afterparsing.Retry-Afterparsing covers seconds, whitespace, and unsupported HTTP-date values.Verification
All pass.
Closes #45