Skip to content
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

Merged
merged 3 commits into from
Feb 25, 2021
Merged

[8.x] Add perMinutes method for RateLimiting #36352

merged 3 commits into from
Feb 25, 2021

Conversation

intrepidws
Copy link
Contributor

This PR allows the perMinute method to accept an optional argument for the number of decay minutes. This allows the perMinute method to function in the same way that the perHour and perDay methods function.

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.
@GrahamCampbell GrahamCampbell changed the title Add minute argument to perMinute method for RateLimiting [8.x] Add minute argument to perMinute method for RateLimiting Feb 22, 2021
@@ -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)
Copy link
Member

@driesvints driesvints Feb 23, 2021

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.

Copy link
Contributor Author

@intrepidws intrepidws Feb 23, 2021

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?

Copy link
Member

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.

Copy link
Contributor Author

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.

Copy link
Contributor Author

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.

@taylorotwell
Copy link
Member

You can add a new perMinutes function instead.

@intrepidws
Copy link
Contributor Author

Glad you agree @taylorotwell, I have created the new perMinutes function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants