Skip to content

Commit

Permalink
[10.x] Add fail on timeout to queue listener (#50352)
Browse files Browse the repository at this point in the history
* feat: add fail on timeout to queue listener

* Update CallQueuedListener.php

* Update Dispatcher.php

---------

Co-authored-by: Taylor Otwell <[email protected]>
  • Loading branch information
saeedhosseiinii and taylorotwell authored Mar 4, 2024
1 parent 9b97007 commit d562c06
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Illuminate/Events/CallQueuedListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,13 @@ class CallQueuedListener implements ShouldQueue
*/
public $timeout;

/**
* Indicates if the job should fail if the timeout is exceeded.
*
* @var bool
*/
public $failOnTimeout = false;

/**
* Indicates if the job should be encrypted.
*
Expand Down
1 change: 1 addition & 0 deletions src/Illuminate/Events/Dispatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -674,6 +674,7 @@ protected function propagateListenerOptions($listener, $job)
$job->retryUntil = method_exists($listener, 'retryUntil') ? $listener->retryUntil(...$data) : null;
$job->shouldBeEncrypted = $listener instanceof ShouldBeEncrypted;
$job->timeout = $listener->timeout ?? null;
$job->failOnTimeout = $listener->failOnTimeout ?? false;
$job->tries = $listener->tries ?? null;

$job->through(array_merge(
Expand Down

0 comments on commit d562c06

Please sign in to comment.