Add retry logic with exponential backoff and jitter for rate limits a…#6
Merged
alex-omophub merged 1 commit intomainfrom Mar 30, 2026
Merged
Add retry logic with exponential backoff and jitter for rate limits a…#6alex-omophub merged 1 commit intomainfrom
alex-omophub merged 1 commit intomainfrom
Conversation
…nd server errors - Introduced a new `_calculate_retry_delay` function to handle retry delays based on the Retry-After header and exponential backoff with jitter. - Updated `SyncHTTPClient` and `AsyncHTTPClientImpl` to utilize the new retry delay calculation for handling rate limits (429) and server errors (502, 503, 504). - Enhanced retry mechanism to improve resilience against temporary issues.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
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.
…nd server errors
_calculate_retry_delayfunction to handle retry delays based on the Retry-After header and exponential backoff with jitter.SyncHTTPClientandAsyncHTTPClientImplto utilize the new retry delay calculation for handling rate limits (429) and server errors (502, 503, 504).Summary by cubic
Add smarter retry handling for rate limits and transient server errors using exponential backoff with jitter. This improves resilience and respects server Retry-After guidance across both sync and async HTTP clients.
_calculate_retry_delay()that honorsRetry-After(up to 60s) or falls back to exponential backoff starting at 0.5s, capped at 8s, with 25% jitter.SyncHTTPClientandAsyncHTTPClientImplto retry on429,502,503, and504using the new delay logic.Written for commit 9bf08d1. Summary will update on new commits.