-
Notifications
You must be signed in to change notification settings - Fork 4.8k
[12.x] Improve Queues and Horizon documentation #10596
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
base: 12.x
Are you sure you want to change the base?
Conversation
@@ -1213,7 +1215,21 @@ class ProcessPodcast implements ShouldQueue | |||
<a name="max-attempts"></a> | |||
#### Max Attempts | |||
|
|||
If one of your queued jobs is encountering an error, you likely do not want it to keep retrying indefinitely. Therefore, Laravel provides various ways to specify how many times or for how long a job may be attempted. |
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 section was confusing to me, as it mixed errors and attempts, so I tried to explain as clearly as possible what an ‘attempt’ is.
> [!NOTE] | ||
> A job marked failed will never be retried. | ||
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 might be redundant, but I added it for people who might not read the entire documentation as they should
Co-authored-by: Andrew Brown <browner12@gmail.com>
Co-authored-by: Andrew Brown <browner12@gmail.com>
Co-authored-by: Andrew Brown <browner12@gmail.com>
Co-authored-by: Andrew Brown <browner12@gmail.com>
Co-authored-by: Andrew Brown <browner12@gmail.com>
Co-authored-by: Andrew Brown <browner12@gmail.com>
Co-authored-by: Andrew Brown <browner12@gmail.com>
Co-authored-by: Andrew Brown <browner12@gmail.com>
Co-authored-by: Andrew Brown <browner12@gmail.com>
Co-authored-by: Andrew Brown <browner12@gmail.com>
Co-authored-by: Andrew Brown <browner12@gmail.com>
Co-authored-by: Andrew Brown <browner12@gmail.com>
Co-authored-by: Andrew Brown <browner12@gmail.com>
Co-authored-by: Andrew Brown <browner12@gmail.com>
About
This PR is based on a recent post I shared on X, where I discussed some pain points around Horizon.
I did my best to avoid injecting strong personal opinions or turning the documentation into a blog post.
Queues:
Clarifies how job attempts are counted and how failed jobs are handled. Adds updated examples and notes for middleware and retries.
Horizon:
Adds sections on queue priorities, job attempts, timeouts, and backoff. Improves explanations for environment configuration and worker balancing.
There are still options left to document.
Reflections on
maxException
andtries
DefaultsWhile working on this PR, I strongly felt the need for an option to configure
maxExceptions
at the Horizon supervisor or queue worker level, similar to howtries
can currently be set.Additionally, I’m wondering whether the default value for
tries
is appropriate. Many of Laravel’s advanced queue features, such asWithoutOverlapping
andRateLimited
, often require increasing thetries
value significantly, sometimes even setting it to0
.In my opinion, the default configuration should be more aligned with these common use cases. A more sensible default might look like:
tries
: 25maxException
: 1This defaults would work better out of the box for most Laravel developers .