diff --git a/src/Illuminate/Queue/CallQueuedHandler.php b/src/Illuminate/Queue/CallQueuedHandler.php index cc3d8934ca4a..adb7b19e11b9 100644 --- a/src/Illuminate/Queue/CallQueuedHandler.php +++ b/src/Illuminate/Queue/CallQueuedHandler.php @@ -30,13 +30,6 @@ class CallQueuedHandler */ protected $container; - /** - * Indicates if the unique job lock has been released. - * - * @var bool - */ - protected $uniqueLockReleased = false; - /** * Create a new handler instance. * @@ -73,7 +66,7 @@ public function call(Job $job, array $data) $this->dispatchThroughMiddleware($job, $command); - if (! $job->isReleased()) { + if (! $job->isReleased() && ! $command instanceof ShouldBeUniqueUntilProcessing) { $this->ensureUniqueJobLockIsReleased($command); } @@ -179,7 +172,7 @@ protected function ensureSuccessfulBatchJobIsRecorded($command) */ protected function ensureUniqueJobLockIsReleased($command) { - if (! $command instanceof ShouldBeUnique || $this->uniqueLockReleased) { + if (! $command instanceof ShouldBeUnique) { return; } @@ -194,8 +187,6 @@ protected function ensureUniqueJobLockIsReleased($command) $cache->lock( 'laravel_unique_job:'.get_class($command).$uniqueId )->forceRelease(); - - $this->uniqueLockReleased = true; } /** @@ -237,7 +228,10 @@ public function failed(array $data, $e, string $uuid) { $command = unserialize($data['command']); - $this->ensureUniqueJobLockIsReleased($command); + if (! $command instanceof ShouldBeUniqueUntilProcessing) { + $this->ensureUniqueJobLockIsReleased($command); + } + $this->ensureFailedBatchJobIsRecorded($uuid, $command, $e); $this->ensureChainCatchCallbacksAreInvoked($uuid, $command, $e);