-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[RateLimiter] Added reserve() to LimiterInterface and rename Limiter to RateLimiter #38562
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
Merged
Conversation
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
wouterj
commented
Oct 14, 2020
👍 for |
(rebase needed) |
b1776ee
to
5e3991d
Compare
fabpot
approved these changes
Oct 15, 2020
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.
Ready IMHO when the TODO is resolved
derrabus
requested changes
Oct 15, 2020
src/Symfony/Component/RateLimiter/Exception/MaxWaitDurationExceededException.php
Outdated
Show resolved
Hide resolved
87a3ec8
to
783875d
Compare
fabpot
approved these changes
Oct 16, 2020
783875d
to
cd34f21
Compare
Thank you @wouterj. |
chalasr
added a commit
that referenced
this pull request
Oct 22, 2020
This PR was merged into the 5.x branch. Discussion ---------- [RateLimiter] Remove Window::sleep() | Q | A | ------------- | --- | Branch? | 5.x | Bug fix? | no | New feature? | no | Deprecations? | | Tickets | | License | MIT | Doc PR | This function is not needed since #38562 Commits ------- ccbf7d5 [RateLimiter] Remove Window::sleep()
chalasr
added a commit
that referenced
this pull request
Oct 24, 2020
…holm) This PR was squashed before being merged into the 5.x branch. Discussion ---------- [RateLimiter] Rename RateLimiter to RateLimiterFactory | Q | A | ------------- | --- | Branch? | 5.x | Bug fix? | no | New feature? | no | Deprecations? | No, not released yet | Tickets | | License | MIT | Doc PR | should be added Sorry for making a few BC breaks. @wouterj [said](#38562 (comment)) that this class was suggested to be named `LimiterFactory` before. But that was rejected. Just my looking at the names of the classes we currently have: - Rate - RateLimit - RateLimiter I find it hard to know what these are doing and the difference between them. Note that none of them are used as a rate limiter (ie implements `LimiterInterface`) I would like to be clear that a `RateLimiterFactory` is used to create an object implementing `LimiterInterface`. Commits ------- 8be261b [RateLimiter] Rename RateLimiter to RateLimiterFactory
symfony-splitter
pushed a commit
to symfony/rate-limiter
that referenced
this pull request
Oct 24, 2020
…holm) This PR was squashed before being merged into the 5.x branch. Discussion ---------- [RateLimiter] Rename RateLimiter to RateLimiterFactory | Q | A | ------------- | --- | Branch? | 5.x | Bug fix? | no | New feature? | no | Deprecations? | No, not released yet | Tickets | | License | MIT | Doc PR | should be added Sorry for making a few BC breaks. @wouterj [said](symfony/symfony#38562 (comment)) that this class was suggested to be named `LimiterFactory` before. But that was rejected. Just my looking at the names of the classes we currently have: - Rate - RateLimit - RateLimiter I find it hard to know what these are doing and the difference between them. Note that none of them are used as a rate limiter (ie implements `LimiterInterface`) I would like to be clear that a `RateLimiterFactory` is used to create an object implementing `LimiterInterface`. Commits ------- 8be261b300 [RateLimiter] Rename RateLimiter to RateLimiterFactory
Merged
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.
While Javier wrote documentation for this new component, we found a couple of confusing elements that might need some tweaks:
Limiter
class (previously calledLimiterFactory
) has imho a bit strange name, as it's not a limiter and it doesn't implementLimiterInterface
. It can only new limiters. I believeLimiterFactory
- likeLockFactory
- would be the most clear, but as that was rejected before, here is another proposal usingRateLimiter
.reserve()
was now only part of the token bucket implementation. That made it a bit less useful. I think I've found a way to also allow reserving future hits in the fixed window implementation, so I've moved it to theLimiterInterface
.