Skip to content

Commit

Permalink
prevent calling tries twice (#53010)
Browse files Browse the repository at this point in the history
  • Loading branch information
themsaid authored Oct 2, 2024
1 parent 46dc7a4 commit 60c2ba9
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/Illuminate/Queue/Queue.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ protected function createObjectPayload($job, $queue)
'uuid' => (string) Str::uuid(),
'displayName' => $this->getDisplayName($job),
'job' => 'Illuminate\Queue\CallQueuedHandler@call',
'maxTries' => $this->getJobTries($job) ?? null,
'maxTries' => $this->getJobTries($job),
'maxExceptions' => $job->maxExceptions ?? null,
'failOnTimeout' => $job->failOnTimeout ?? false,
'backoff' => $this->getJobBackoff($job),
Expand Down Expand Up @@ -191,13 +191,11 @@ public function getJobTries($job)
return;
}

if (isset($job->tries)) {
return $job->tries;
if (is_null($tries = $job->tries ?? $job->tries())) {
return;
}

if (method_exists($job, 'tries') && ! is_null($job->tries())) {
return $job->tries();
}
return $tries;
}

/**
Expand Down

0 comments on commit 60c2ba9

Please sign in to comment.