Skip to content

Commit

Permalink
expire the cache keys (#31854)
Browse files Browse the repository at this point in the history
  • Loading branch information
themsaid authored Mar 9, 2020
1 parent a2ca152 commit 2cc864b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Illuminate/Queue/Worker.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down

0 comments on commit 2cc864b

Please sign in to comment.