-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
[RateLimiting] Handle Timer jitter #74360
Conversation
Tagging subscribers to this area: @mangod9 Issue DetailsFixes #74056 Two approaches are used here, we "trust the timer" when auto replenish is enabled so FixedWindow and SlidingWindow will always move the window when the timer fires. And in the token bucket case we change to use a fill rate internally and update with partial tokens when replenish is called, no matter how frequently. Also added validation for not passing TimeSpan.Zero to the limiters, but we could revert that if we just want TimeSpan.Zero to mean never replenish (Timer already uses TimeSpan.Zero as never run the timer).
|
/backport to release/7.0 |
Started backporting to release/7.0: https://github.com/dotnet/runtime/actions/runs/2975631117 |
Failures are tracked by #74952 unrelated to this change. Merging. |
Fixes #74056
Two approaches are used here, we "trust the timer" when auto replenish is enabled so FixedWindow and SlidingWindow will always move the window when the timer fires. And in the token bucket case we change to use a fill rate internally and update with partial tokens when replenish is called, no matter how frequently.
Also added validation for not passing TimeSpan.Zero to the limiters, but we could revert that if we just want TimeSpan.Zero to mean never replenish (Timer already uses TimeSpan.Zero as never run the timer).