Repository navigation
fix: keep an active rate limit when a later header is shorter - #8336
Draft
Kayvan-Zahiri wants to merge 1 commit into
Draft
Kayvan-Zahiri wants to merge 1 commit into
Kayvan-Zahiri wants to merge 1 commit into
Conversation
The transport spec says a new shorter limit must not replace one that is still running. Co-authored-by: Cursor <cursoragent@cursor.com>
This branch has not been deployed
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.
Fixes #8296.
HttpTransportCorestored rate limits withdict.update, so a later shorter limit replaced a longer one that was still active. The same header can do it on its own:3600:error:organization, 0:error:projectleft errors unlimited. A laterRetry-Afteron 429 did the same to the all-categories limit.The transport spec says to keep the longer deadline. A new limit is stored only when it ends later than the one already recorded, so an expired deadline still gives way to a fresh one.
Tests:
3600:errorthen0:errorin one header keeps the long deadline, a later1:errordoes not shorten it, and a 1 secondRetry-Afterdoes not shorten an active global limittests/test_transport.py—test_shorter_rate_limit_keeps_the_longer_deadline,test_rate_limit_header_does_not_shorten_active_limit, and the existing parse tests. 7 passed.No live Sentry project. I used AI assistance for the patch.
Made with Cursor