From 6202b112058b31cbd342d52703de7965aec63441 Mon Sep 17 00:00:00 2001 From: Nandor Kraszlan Date: Tue, 12 Mar 2024 09:14:03 +0000 Subject: [PATCH] Try to resolve config from job --- src/Illuminate/Queue/Middleware/Debounced.php | 9 +++++---- tests/Queue/QueueSyncQueueTest.php | 2 ++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/Illuminate/Queue/Middleware/Debounced.php b/src/Illuminate/Queue/Middleware/Debounced.php index 1090d434bf5f..a5222429778c 100644 --- a/src/Illuminate/Queue/Middleware/Debounced.php +++ b/src/Illuminate/Queue/Middleware/Debounced.php @@ -18,10 +18,11 @@ class Debounced */ public function handle(mixed $job, $next) { - if (($job->connection ?? config('queue.default')) === 'sync') { - if (config('app.debug') && app()->isLocal()) { - throw new \LogicException('Debounced jobs must not run on the sync queue.'); - } + if (($job->connection ?? $job->job->getConnectionName()) === 'sync') { + +// if (config('app.debug') && app()->isLocal()) { +// throw new \LogicException('Debounced jobs must not run on the sync queue.'); +// } $next($job); return; diff --git a/tests/Queue/QueueSyncQueueTest.php b/tests/Queue/QueueSyncQueueTest.php index a361bf5e773b..182c6d2495d5 100755 --- a/tests/Queue/QueueSyncQueueTest.php +++ b/tests/Queue/QueueSyncQueueTest.php @@ -150,6 +150,8 @@ class SyncQueueJob implements ShouldQueue { use InteractsWithQueue; + public string $connection = 'sync'; + public function handle() { throw new LogicException($this->getValueFromJob('extra'));