|
| 1 | +# Legacy overlap release delay |
| 2 | + |
| 3 | +Applications using `Workflow\Workflow` can back off queue jobs that cannot |
| 4 | +acquire an overlap lock: |
| 5 | + |
| 6 | +```php |
| 7 | +use Workflow\WorkflowOptions; |
| 8 | +use Workflow\WorkflowStub; |
| 9 | + |
| 10 | +$workflow = WorkflowStub::make(MyWorkflow::class); |
| 11 | +$workflow->start('argument', new WorkflowOptions(overlapReleaseAfter: 5)); |
| 12 | +``` |
| 13 | + |
| 14 | +`WorkflowOptions::set(['overlapReleaseAfter' => 5])` accepts the same setting. |
| 15 | +The delay is a nonnegative integer in seconds. Its default is zero, preserving |
| 16 | +existing behavior and stored options. It applies to contended workflow, |
| 17 | +activity, signal and child-completion queue jobs. It does not change lock |
| 18 | +expiry, semaphore ownership, or activity exception backoff. |
| 19 | + |
| 20 | +The setting is saved with the run. Children and continue-as-new inherit it |
| 21 | +when no explicit `WorkflowOptions` is supplied. An explicit options object |
| 22 | +replaces inherited options, including resetting this delay to zero if omitted. |
| 23 | + |
| 24 | +Laravel counts queue reservations as attempts even when middleware releases |
| 25 | +the job before its handler executes. A positive delay reduces rapid retries; |
| 26 | +it does not make a low `$tries`, `--tries`, or database queue attempt limit |
| 27 | +safe for arbitrary contention. Choose the delay and retry budget for the |
| 28 | +expected lock duration. Keep queue visibility and worker timeout settings |
| 29 | +consistent with activity duration. |
| 30 | + |
| 31 | +This option belongs to the legacy API. `Workflow\V2\Workflow` uses durable |
| 32 | +task claims and does not use this overlap middleware. |
0 commit comments