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

[11.x] Add decrement method to the rate limiter class #51102

Merged
merged 1 commit into from
Apr 17, 2024

Conversation

AlexJump24
Copy link
Contributor

I ran into a scenario with a third party API where I was calling their API on a rate limited job. The job was consumed and therefore reduced the rate limit, but I wanted to catch the exception and decrease the rate limit again.

I could get around this by calling RateLimiter::increment(...) and passing it a negative value e.g. -1, but thought it would be a nicer DX to have a decrement method available like in other cache classes.

I have followed the approach for how other cache classes achieve this for consistency.

@taylorotwell taylorotwell merged commit d58be75 into laravel:11.x Apr 17, 2024
30 checks passed
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.

2 participants