Skip to content

Commit ee385fa

Browse files
committed
use tries as the property
1 parent 2382dc3 commit ee385fa

4 files changed

Lines changed: 9 additions & 9 deletions

File tree

src/Illuminate/Queue/Jobs/Job.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,9 +239,9 @@ public function payload()
239239
*
240240
* @return int|null
241241
*/
242-
public function retries()
242+
public function maxTries()
243243
{
244-
return array_get($this->payload(), 'retries');
244+
return array_get($this->payload(), 'maxTries');
245245
}
246246

247247
/**

src/Illuminate/Queue/Queue.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ protected function createPayload($job, $data = '', $queue = null)
8181
if (is_object($job)) {
8282
$payload = json_encode([
8383
'job' => 'Illuminate\Queue\CallQueuedHandler@call',
84-
'retries' => isset($job->retries) ? $job->retries : null,
84+
'maxTries' => isset($job->tries) ? $job->tries : null,
8585
'timeout' => isset($job->timeout) ? $job->timeout : null,
8686
'data' => [
8787
'commandName' => get_class($job),

src/Illuminate/Queue/Worker.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ protected function handleJobException($connectionName, $job, WorkerOptions $opti
281281
*/
282282
protected function markJobAsFailedIfAlreadyExceedsMaxAttempts($connectionName, $job, $maxTries)
283283
{
284-
$maxTries = ! is_null($job->retries()) ? $job->retries() : $maxTries;
284+
$maxTries = ! is_null($job->maxTries()) ? $job->maxTries() : $maxTries;
285285

286286
if ($maxTries === 0 || $job->attempts() <= $maxTries) {
287287
return;
@@ -308,7 +308,7 @@ protected function markJobAsFailedIfAlreadyExceedsMaxAttempts($connectionName, $
308308
protected function markJobAsFailedIfHasExceededMaxAttempts(
309309
$connectionName, $job, $maxTries, $e
310310
) {
311-
$maxTries = ! is_null($job->retries()) ? $job->retries() : $maxTries;
311+
$maxTries = ! is_null($job->maxTries()) ? $job->maxTries() : $maxTries;
312312

313313
if ($maxTries === 0 || $job->attempts() < $maxTries) {
314314
return;

tests/Queue/QueueWorkerTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ public function test_job_based_max_retries()
136136
});
137137
$job->attempts = 2;
138138

139-
$job->retries = 10;
139+
$job->maxTries = 10;
140140

141141
$worker = $this->getWorker('default', ['queue' => [$job]]);
142142
$worker->runNextJob('default', 'queue', $this->workerOptions(['maxTries' => 1]));
@@ -239,7 +239,7 @@ class WorkerFakeJob
239239
public $callback;
240240
public $deleted = false;
241241
public $releaseAfter;
242-
public $retries;
242+
public $maxTries;
243243
public $attempts = 0;
244244
public $failedWith;
245245

@@ -260,9 +260,9 @@ public function payload()
260260
return [];
261261
}
262262

263-
public function retries()
263+
public function maxTries()
264264
{
265-
return $this->retries;
265+
return $this->maxTries;
266266
}
267267

268268
public function delete()

0 commit comments

Comments
 (0)