What this thread does
Do first: run the worker with an explicit --timeout several seconds shorter than the connection's retry_after, then select finite attempts and delayed retries.
Short answer
As of November 2026, this card targets the maintained security line Laravel 12, not a claim about the latest major. Use idempotent side effects before exposing a manual retry button.
Choose / don't choose
ShouldBeUnique: choose dispatch deduplication; don't treat it as a processing lock for every replay path. The queue guide describes the dispatch lock.WithoutOverlapping: choose exclusion while a job executes, keyed to the protected resource; don't assume it guarantees exactly-once effects. Manual retries still need idempotency. The middleware API exposes release and expiry controls.
Not for: diagnosing synchronous endpoint latency; see laravel-speed-up-slow-page-endpoint-query-or-php-profile.
Settings that matter
| Setting or flag | Value / default | Applies to | Source |
|---|---|---|---|
--timeout | Default 60 seconds; choose below retry_after by several seconds | Linked worker implementation and queue connection | command, guide |
retry_after | Longer than --timeout; SQS uses visibility timeout instead | Linked queue docs | guide |
queue:work --tries | Default 1; example policy 3; 0 means unlimited, so avoid it for bounded service retries | Linked worker implementation | command, guide |
queue:work --backoff | Default 0 seconds; example policy 3 seconds between exception retries | Linked worker implementation | command, guide |
after_commit / afterCommit() | Connection true makes Laravel wait for open parent transactions; use per-dispatch afterCommit() when its records must be committed first | Linked queue docs | guide |
releaseAfter() | Positive delay in seconds to release the job back to the queue; choose from contention | Linked middleware API | API |
expireAfter() | Explicit lock expiry long enough for the bounded operation | Linked middleware API | API |
shared() | Enable when different job classes protect the same resource key | Linked middleware API | API |
Order of operations
1. Make the external effect idempotent with a stable operation ID. Separate a retryable delivery attempt from a business operation already completed; a queue lock cannot undo a duplicate remote charge. 2. Dispatch after commit when the job needs newly written rows. Example worker policy: php artisan queue:work --timeout=60 --tries=3 --backoff=3; choose a connection retry_after above that timeout, such as 90 seconds, only if the job fits this budget (queue guide, command definition). 3. Inspect php artisan queue:failed; retry only the selected identifier with php artisan queue:retry <id>. Avoid all for an individual recovery (guide). 4. For an operator UI, authorize each retry, show redacted failure metadata, record the selected ID and operator, and prevent repeated clicks. Check idempotency and current resource state before retrying. These are application controls; the CLI does not supply their authorization model.
Known failures and fixes
| Error (short quote) | Cause | Fix | Source |
|---|---|---|---|
MaxAttemptsExceededException | Attempts exhausted; overlap releases can consume attempts | Inspect the failure before replay; tune overlap release delay and finite attempts together | exception API, queue guide |
“does not acquire the UniqueLock” | Historical issue describes interaction between released jobs and dispatch uniqueness | Use a processing lock and idempotency for execution safety; do not infer replay exclusion from uniqueness alone | Laravel issue 48013 |
The dated unique-job discussion 47852 describes attempts resetting on manual retry. Treat a replay as a new execution opportunity, with its own operator and idempotency checks.
Missing
- The linked source does not confirm: Queue dispatch and concurrency locks solve different problems.
- Queue driver, maximum legitimate runtime and external request timeouts are unspecified. No universal timeout or lock expiry is safe for all jobs.
- Job-level retry policy may override worker options; inspect the actual job before promising an operator a fixed retry count.
Started from a post by @Laravel, packaged by the editor. Original post