[csharp][generichost] Revert to DropWrite#24080
Merged
wing328 merged 1 commit intoJun 21, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
1 issue found across 50 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
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.
Partial revert from #22233 In most simple cases we are only going to be concerned about rate limiting. For other concerns, we can give new default limiters for each token type. Users can also provide their own rate limiter. We can consider other changes as well to address some of what EraYaN said feels off about the approach currently used. The following is copilot's view on it.
C# GenericHost: revert
BoundedChannelFullModeinRateLimitProviderfromDropOldesttoDropWritePR #22233 changed
BoundedChannelFullModeinRateLimitProviderfromDropWritetoDropOldest. This reverts that change.Why
DropWriteis correctThe bounded channel in
RateLimitProviderhas a capacity equal tocontainer.Tokens.Count. Each token writes itself to the channel when its rate-limit timer fires. A full channel simply means every token is already queued and available — any additional write for that token is a no-op duplicate.DropWritehandles this correctly by silently discarding the redundant write.DropOldestevicts the longest-waiting token from the front of the queue to make room for the incoming write. This is actively harmful for rate limiting:DropOldestcan cause tokens to "disappear." If the evicted token'sTokenBecameAvailableevent doesn't fire again immediately, the channel will have one fewer token than expected until the next timer tick.Note on JIT / OAuth tokens
The concern raised in #22233 about token freshness and expired claims is valid but belongs in a different
TokenProvidersubclass designed for JIT/OAuth flows, not inRateLimitProviderwhich is designed solely for fixed-key rate limiting.Changes
RateLimitProvider\1.mustache:BoundedChannelFullMode.DropOldest→BoundedChannelFullMode.DropWrite`PR checklist
Commit all changed files.
This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
These must match the expectations made by your contribution.
You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example
./bin/generate-samples.sh bin/configs/java*.IMPORTANT: Do NOT purge/delete any folders/files (e.g. tests) when regenerating the samples as manually written tests may be removed.