-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[RateLimiter] Adding SlidingWindow algorithm #38565
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
👍 I like this. Thanks! |
b50387b
to
46c047f
Compare
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.
Apart from my comments, this looks good to me.
@fabpot would be cool to also have this in 5.2, though it's not 100% needed. Sliding windows generally is better than fixed windows, as they flatten bursts much better.
8eef7ae
to
eb1d3d0
Compare
} | ||
} | ||
|
||
private function getAvailableTokens(int $hitCount): int |
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.
This method is public in FixedWindow
,
@wouterj is that a bug? It is not part of the interface and never used outside of the class.
d81174f
to
c6d3b70
Compare
Thank you @Nyholm. |
Thank you for merging |
This is a draft PR to make sure we like the idea. I'll keep working on adding tests.