/** * Mark the given job as failed if it has exceeded the maximum allowed attempts. * * @param string $connectionName * @param \Illuminate\Contracts\Queue\Job $job * @param int $maxTries * @param \Exception $e * @return void */ protected function markJobAsFailedIfHasExceededMaxAttempts($connectionName, $job, $maxTries, $e) { $maxTries = !is_null($job->maxTries()) ? $job->maxTries() : $maxTries; if ($maxTries === 0 || $job->attempts() < $maxTries) { return; } $this->failJob($connectionName, $job, $e); }