-
Notifications
You must be signed in to change notification settings - Fork 675
fix(utils): prevent negative sleep time in rate limit retry #3308
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
a0c3667 to
6470802
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3308 +/- ##
=======================================
Coverage 95.72% 95.72%
=======================================
Files 98 98
Lines 6052 6052
=======================================
Hits 5793 5793
Misses 259 259
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
@JohnVillalovos: Could you take a look at this change? Please |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes a bug where negative sleep times could occur when processing rate limit responses with RateLimit-Reset headers that contain timestamps in the past.
Key changes:
- Added
max(0, ...)guard to prevent negative wait time calculation whenRateLimit-Resettimestamp is in the past
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
6470802 to
895874f
Compare
JohnVillalovos
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @AlexandreEXFO
LGTM
Changes
Resolution of the error that sometimes occurs: "Error: sleep length must be non-negative"
Documentation and testing
Please consider whether this PR needs documentation and tests. This is not required, but highly appreciated: