Skip to content

Commit

Permalink
Try to resolve config from job
Browse files Browse the repository at this point in the history
  • Loading branch information
nandi95 committed Mar 12, 2024
1 parent 859c1aa commit 6202b11
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/Illuminate/Queue/Middleware/Debounced.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions tests/Queue/QueueSyncQueueTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ class SyncQueueJob implements ShouldQueue
{
use InteractsWithQueue;

public string $connection = 'sync';

public function handle()
{
throw new LogicException($this->getValueFromJob('extra'));
Expand Down

0 comments on commit 6202b11

Please sign in to comment.