From 43792d727ef5403df8b22d797b537519b07fa336 Mon Sep 17 00:00:00 2001 From: Saeed Hosseini Date: Sun, 3 Mar 2024 18:16:17 +0330 Subject: [PATCH] feat: add fail on timeout to queue listener --- src/Illuminate/Events/CallQueuedListener.php | 7 +++++++ src/Illuminate/Events/Dispatcher.php | 1 + 2 files changed, 8 insertions(+) diff --git a/src/Illuminate/Events/CallQueuedListener.php b/src/Illuminate/Events/CallQueuedListener.php index 6a39008520c8..d5743e3e7d6e 100644 --- a/src/Illuminate/Events/CallQueuedListener.php +++ b/src/Illuminate/Events/CallQueuedListener.php @@ -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. * diff --git a/src/Illuminate/Events/Dispatcher.php b/src/Illuminate/Events/Dispatcher.php index 2f3ac4cb9a76..ca7d38e6b405 100755 --- a/src/Illuminate/Events/Dispatcher.php +++ b/src/Illuminate/Events/Dispatcher.php @@ -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) : [],