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] Document new ThrottlesExceptions job middleware #6892

Merged
merged 1 commit into from
Mar 9, 2021
Merged

[8.x] Document new ThrottlesExceptions job middleware #6892

merged 1 commit into from
Mar 9, 2021

Conversation

paras-malhotra
Copy link
Contributor

Documentation for laravel/framework#36473 and laravel/framework#36518 for the upcoming release.

If laravel/framework#36518 isn't merged before the upcoming release, we can just delete the last "tip" line from this PR.

@paras-malhotra paras-malhotra changed the title Document new ThrottlesExceptions job middleware [8.x] Document new ThrottlesExceptions job middleware Mar 9, 2021
@taylorotwell taylorotwell merged commit e3c513d into laravel:8.x Mar 9, 2021
@taylorotwell
Copy link
Member

@paras-malhotra I've made some changes to this feature since original merge. First, the job's uniquely assigned UUID is the default cache key and may be overwritten by the by method. Second, the "retry after minutes" has been changed to backoff and is specified in seconds instead of minutes to allow for a more granular approach.

@paras-malhotra paras-malhotra deleted the throttles_exceptions branch March 9, 2021 15:12
@paras-malhotra
Copy link
Contributor Author

paras-malhotra commented Mar 9, 2021

@taylorotwell wouldn't setting the cache key as the job UUID mean that subsequent jobs of the same class would not be short circuited? So, say I have a job that hits an API for each user. The API is down and I need all subsequent jobs (of the same class but maybe for different users) to be short circuited to give enough time for the service to recover.

I think it might be better to have this set to the job class because I think it may serve as a better default for this middleware.

@taylorotwell
Copy link
Member

@paras-malhotra yeah I could see your reasoning there - let me take a look at it again.

@taylorotwell
Copy link
Member

I've updated it to use the class name by default and added a byJob method to quickly indicate it should use the UUID:

new ThrottlesException(...)->byJob()

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