/**
  * {@inheritdoc}
  *
  * @codeCoverageIgnore
  */
 public function attempts() : int
 {
     return $this->job ? $this->job->attempts() : 1;
 }
Example #2
0
 /**
  * {@inheritdoc}
  */
 public function process(string $connection, JobContract $job, int $maxTries = 0, int $delay = 0)
 {
     if ($maxTries > 0 && $job->attempts() > $maxTries) {
         return $this->logFailedJob($connection, $job);
     }
     try {
         $this->raiseBeforeJobEvent($connection, $job);
         // Here we will run off the job and let it process. We will catch any exceptions so
         // they can be reported to the developers logs, etc. Once the job is finished the
         // proper events will be emited to let any listeners know this job has finished.
         $job->run();
         $this->raiseAfterJobEvent($connection, $job);
     } catch (Throwable $e) {
         $this->handleJobException($connection, $job, $delay, $e);
     }
 }