[12.x] Improve Queues and Horizon documentation #10596
Draft
+170
−4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 .