Skip to content

Commit

Permalink
feat: add fail on timeout to queue listener
Browse files Browse the repository at this point in the history
  • Loading branch information
saeedhosseiinii committed Mar 3, 2024
1 parent 119a3a3 commit 43792d7
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 @@ -75,6 +75,13 @@ class CallQueuedListener implements ShouldQueue
*/
public $shouldBeEncrypted = false;

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

/**
* Create a new job instance.
*
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 @@ -675,6 +675,7 @@ protected function propagateListenerOptions($listener, $job)
$job->shouldBeEncrypted = $listener instanceof ShouldBeEncrypted;
$job->timeout = $listener->timeout ?? null;
$job->tries = $listener->tries ?? null;
$job->failOnTimeout = $listener->failOnTimeout ?? false;

$job->through(array_merge(
method_exists($listener, 'middleware') ? $listener->middleware(...$data) : [],
Expand Down

0 comments on commit 43792d7

Please sign in to comment.