Repository navigation
fix: keep the longer rate limit when a later response sends a shorter one - #5946
Merged
Merged
Conversation
… one Closes #5945 Co-Authored-By: Ricardo Oliveira <ricardo.oliveira@sentry.io>
Contributor
|
Mutation testing breaks the lines a PR changes on purpose, one mutation at a time, and checks that a test fails each time. A changed line no test runs fails the check, and a mutant that survives the tests only warns. Full report Sentry: tests caught 9 of 10 mutants on the changed lines
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5946 +/- ##
==========================================
+ Coverage 77.44% 77.47% +0.02%
==========================================
Files 546 547 +1
Lines 20053 20054 +1
Branches 3962 3963 +1
==========================================
+ Hits 15531 15536 +5
+ Misses 3658 3655 -3
+ Partials 864 863 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
szokeasaurusrex
approved these changes
Nov 16, 2026
Follows the approach of #5947 and getsentry/sentry-rust#1410. Co-Authored-By: Ricardo Oliveira <ricardo.oliveira@sentry.io>
Co-Authored-By: Ricardo Oliveira <ricardo.oliveira@sentry.io>
sentry-junior
Bot
requested review from
jamescrosswell and
ric-oliv
as code owners
November 16, 2026 15:04
jamescrosswell
approved these changes
Nov 16, 2026
27 tasks done
This was referenced Nov 17, 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.
HttpTransportBase.ExtractRateLimitswrote eachX-Sentry-Rate-Limitsreset straight into a dictionary. A later response with a shorter limit for a category that was already limited replaced the longer one, and the SDK sent that category again before the quota expired. The rate limiting spec says to keep the longer one.A type now enforces the rule, not the call site, the same way getsentry/sentry-rust#1410 fixes it. The resets live in a new internal
RateLimitResetsclass whoseConcurrentDictionaryis private. Its only write operation,Extend, stores the later of the current and new reset times, so no update path can shorten an active limit. TheOrderBy(rl => rl.RetryAfter)inExtractRateLimits, which only protected limits within one header, is removed. No public API changes.RetryAfterHandler(429 withoutX-Sentry-Rate-Limits) is unchanged: it short-circuits every request while its limit is active, so a later response cannot shorten it.This takes over the approach from the closed duplicate #5947. Same bug as getsentry/sentry-rust#1409, reported by @itsrayeedscodespace.
Closes #5945
via Ricardo Oliveira.
--
View Session [Sentry]