feat: add support for Retry-After header on 429 responses - #22
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughThe Python and TypeScript clients now honor positive numeric ChangesRetry-After support
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant Client
participant API
participant RetryFlow
participant Timer
Client->>API: Send request
API-->>RetryFlow: Return HTTP 429 with Retry-After
RetryFlow->>RetryFlow: Parse positive retry delay
RetryFlow->>Timer: Wait for server-provided delay
Timer-->>Client: Retry request
Client->>API: Send retry request
API-->>Client: Return success response
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Description
This PR introduces support for parsing and honoring the
Retry-Afterheader when receiving a429 Too Many Requestsresponse. Previously, the libraries relied solely on the exponential backoff calculation. Now, if the header is present and valid, the client will wait for the exact duration requested by the server before retrying, falling back to the standard backoff if it's missing.Affected packages and files:
packages/smooth-api-ts:src/index.ts,tests/resilience.test.tspackages/smooth-api-py:smooth_api/__init__.py,tests/test_resilience.pyREADME.md: Checked off the "Retry-After header support" task.Fixes #1
Type of Change
Please check the option that applies:
Checklist
Design & Parity
README.mdor general documentation where necessary.Quality & Testing
cd sandbox && node server.js) before running the tests.npm run build && npm testinsidepackages/smooth-api-ts) and all tests passed.pytest tests/insidepackages/smooth-api-py) and all tests passed.Summary by CodeRabbit
New Features
Retry-Afterheader, helping requests resume at the server-recommended time.Documentation
Retry-Aftersupport as completed.