Skip to content

Commit d562c06

Browse files
[10.x] Add fail on timeout to queue listener (#50352)
* feat: add fail on timeout to queue listener * Update CallQueuedListener.php * Update Dispatcher.php --------- Co-authored-by: Taylor Otwell <[email protected]>
1 parent 9b97007 commit d562c06

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/Illuminate/Events/CallQueuedListener.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,13 @@ class CallQueuedListener implements ShouldQueue
6868
*/
6969
public $timeout;
7070

71+
/**
72+
* Indicates if the job should fail if the timeout is exceeded.
73+
*
74+
* @var bool
75+
*/
76+
public $failOnTimeout = false;
77+
7178
/**
7279
* Indicates if the job should be encrypted.
7380
*

src/Illuminate/Events/Dispatcher.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -674,6 +674,7 @@ protected function propagateListenerOptions($listener, $job)
674674
$job->retryUntil = method_exists($listener, 'retryUntil') ? $listener->retryUntil(...$data) : null;
675675
$job->shouldBeEncrypted = $listener instanceof ShouldBeEncrypted;
676676
$job->timeout = $listener->timeout ?? null;
677+
$job->failOnTimeout = $listener->failOnTimeout ?? false;
677678
$job->tries = $listener->tries ?? null;
678679

679680
$job->through(array_merge(

0 commit comments

Comments
 (0)