/** * {@inheritdoc} * * @codeCoverageIgnore */ public function release(int $delay = 0) { if ($this->job) { return $this->job->release($delay); } }
/** * Handle an exception that occurred while the job was running. * * @param string $connection * @param \Viserio\Contracts\Queue\Job $job * @param int $delay * @param \Throwable $exception * * @throws \Throwable */ protected function handleJobException(string $connection, JobContract $job, int $delay, Throwable $exception) { // If we catch an exception, we will attempt to release the job back onto the queue // so it is not lost entirely. This'll let the job be retried at a later time by // another listener (or this same one). We will re-throw this exception after. try { if ($this->events !== null) { $this->events->trigger('viserio.job.exception.occurred', ['connection' => $connection, 'job' => $job, 'data' => json_decode($job->getRawBody(), true), 'exception' => $exception]); } } finally { if (!$job->isDeleted()) { $job->release($delay); } } throw $exception; }