diff --git a/src/Illuminate/Queue/Worker.php b/src/Illuminate/Queue/Worker.php index 4af98fe42153..7fa28f9b27aa 100644 --- a/src/Illuminate/Queue/Worker.php +++ b/src/Illuminate/Queue/Worker.php @@ -301,14 +301,16 @@ protected function failJob($connectionName, $job, $e) return; } - // If the job has failed, we will delete it, call the "failed" method and then call - // an event indicating the job has failed so it can be logged if needed. This is - // to allow every developer to better keep monitor of their failed queue jobs. - $job->delete(); - - $job->failed($e); + try { + // If the job has failed, we will delete it, call the "failed" method and then call + // an event indicating the job has failed so it can be logged if needed. This is + // to allow every developer to better keep monitor of their failed queue jobs. + $job->delete(); - $this->raiseFailedJobEvent($connectionName, $job, $e); + $job->failed($e); + } finally { + $this->raiseFailedJobEvent($connectionName, $job, $e); + } } /**