diff --git a/src/Illuminate/Queue/Worker.php b/src/Illuminate/Queue/Worker.php index b1313632edaa..5f70f42f7ac7 100644 --- a/src/Illuminate/Queue/Worker.php +++ b/src/Illuminate/Queue/Worker.php @@ -474,7 +474,13 @@ protected function markJobAsFailedIfWillExceedMaxExceptions($connectionName, $jo return; } + if (! $this->cache->get('job-exceptions:'.$uuid)) { + $this->cache->put('job-exceptions:'.$uuid, 0, Carbon::now()->addDay()); + } + if ($maxExceptions <= $this->cache->increment('job-exceptions:'.$uuid)) { + $this->cache->forget('job-exceptions:'.$uuid); + $this->failJob($job, $e); } }