-
Notifications
You must be signed in to change notification settings - Fork 11.1k
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
[8.x] Add perMinutes method for RateLimiting #36352
Conversation
This PR allows the `perMinute` method accept an optional argument to specify the number of decay minutes. This allows the `perMinute` method to function in the same way that the `perHour` and `perDay` methods function.
@@ -53,9 +53,9 @@ public function __construct($key = '', int $maxAttempts = 60, int $decayMinutes | |||
* @param int $maxAttempts | |||
* @return static | |||
*/ | |||
public static function perMinute($maxAttempts) | |||
public static function perMinute($maxAttempts, $decayMinutes = 1) |
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 is also a breaking change and best sent to master.
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.
I'm sure that I'm missing something, but I don't see how this is a breaking change? All existing code with calls to perMinute
would still work properly, since the second argument is optional, wouldn't it?
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.
If someone if overwriting this method their implementation will break.
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.
Aaah, OK thanks. That makes sense.
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.
Thoughts on whether it would make more sense to create a new perMinutes
or perCustom
method instead? That wouldn't be a breaking change.
You can add a new |
Glad you agree @taylorotwell, I have created the new |
This PR allows the
perMinute
method to accept an optional argument for the number of decay minutes. This allows theperMinute
method to function in the same way that theperHour
andperDay
methods function.