Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Jan 5, 2021
1 parent cdcc60b commit 45eb7a7
Showing 1 changed file with 6 additions and 23 deletions.
29 changes: 6 additions & 23 deletions src/Illuminate/Queue/Console/RetryCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,29 +93,14 @@ protected function getJobIdsByRanges(array $ranges)
protected function retryJob($job)
{
$this->laravel['queue']->connection($job->connection)->pushRaw(
$this->retryRefresh($job->payload), $job->queue
$this->refreshRetryUntil($this->resetAttempts($job->payload)), $job->queue
);
}

/**
* Possibly refresh job attempts and retryUntil value.
*
* @param string $payload
* @return string
*/
protected function retryRefresh($payload)
{
$payload = $this->resetAttempts($payload);

$payload = $this->refreshRetryUntil($payload);

return $payload;
}

/**
* Reset the payload attempts.
*
* Applicable to Redis jobs which store attempts in their payload.
* Applicable to Redis and other jobs which store attempts in their payload.
*
* @param string $payload
* @return string
Expand All @@ -132,7 +117,7 @@ protected function resetAttempts($payload)
}

/**
* Refreshes a jobs retryUntil time with it's own retryUntil method.
* Refresh the "retry until" timestamp for the job.
*
* @param string $payload
* @return string
Expand All @@ -141,12 +126,10 @@ protected function refreshRetryUntil($payload)
{
$payload = json_decode($payload, true);

$jobInstance = unserialize($payload['data']['command']);

if (method_exists($jobInstance, 'retryUntil')) {
$newRetryUntil = $jobInstance->retryUntil()->timestamp;
$instance = unserialize($payload['data']['command']);

$payload['retryUntil'] = $newRetryUntil;
if (is_object($instance) && method_exists($instance, 'retryUntil')) {
$payload['retryUntil'] = $instance->retryUntil()->timestamp;
}

return json_encode($payload);
Expand Down

0 comments on commit 45eb7a7

Please sign in to comment.