Skip to content

Commit

Permalink
use tries as the property
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Nov 4, 2016
1 parent 2382dc3 commit ee385fa
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/Illuminate/Queue/Jobs/Job.php
Original file line number Diff line number Diff line change
Expand Up @@ -239,9 +239,9 @@ public function payload()
*
* @return int|null
*/
public function retries()
public function maxTries()
{
return array_get($this->payload(), 'retries');
return array_get($this->payload(), 'maxTries');
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Queue/Queue.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ protected function createPayload($job, $data = '', $queue = null)
if (is_object($job)) {
$payload = json_encode([
'job' => 'Illuminate\Queue\CallQueuedHandler@call',
'retries' => isset($job->retries) ? $job->retries : null,
'maxTries' => isset($job->tries) ? $job->tries : null,
'timeout' => isset($job->timeout) ? $job->timeout : null,
'data' => [
'commandName' => get_class($job),
Expand Down
4 changes: 2 additions & 2 deletions src/Illuminate/Queue/Worker.php
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ protected function handleJobException($connectionName, $job, WorkerOptions $opti
*/
protected function markJobAsFailedIfAlreadyExceedsMaxAttempts($connectionName, $job, $maxTries)
{
$maxTries = ! is_null($job->retries()) ? $job->retries() : $maxTries;
$maxTries = ! is_null($job->maxTries()) ? $job->maxTries() : $maxTries;

if ($maxTries === 0 || $job->attempts() <= $maxTries) {
return;
Expand All @@ -308,7 +308,7 @@ protected function markJobAsFailedIfAlreadyExceedsMaxAttempts($connectionName, $
protected function markJobAsFailedIfHasExceededMaxAttempts(
$connectionName, $job, $maxTries, $e
) {
$maxTries = ! is_null($job->retries()) ? $job->retries() : $maxTries;
$maxTries = ! is_null($job->maxTries()) ? $job->maxTries() : $maxTries;

if ($maxTries === 0 || $job->attempts() < $maxTries) {
return;
Expand Down
8 changes: 4 additions & 4 deletions tests/Queue/QueueWorkerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public function test_job_based_max_retries()
});
$job->attempts = 2;

$job->retries = 10;
$job->maxTries = 10;

$worker = $this->getWorker('default', ['queue' => [$job]]);
$worker->runNextJob('default', 'queue', $this->workerOptions(['maxTries' => 1]));
Expand Down Expand Up @@ -239,7 +239,7 @@ class WorkerFakeJob
public $callback;
public $deleted = false;
public $releaseAfter;
public $retries;
public $maxTries;
public $attempts = 0;
public $failedWith;

Expand All @@ -260,9 +260,9 @@ public function payload()
return [];
}

public function retries()
public function maxTries()
{
return $this->retries;
return $this->maxTries;
}

public function delete()
Expand Down

0 comments on commit ee385fa

Please sign in to comment.