How do I use retry?
Open
Nobody has claimed this yet.
status:to be verified
- Dominant language
- PHP
- Stars
- 1.1k
- Forks
- 285
- Avg merge
- 5d 3h
- Merged PRs (30d)
- 2
Description
How do I use retry?
| Q | A |
|---|---|
| Yii version | 2.0.15.1 |
| PHP version | 7.2.5 |
| Operating system | linux |
<?php
namespace backend\job;
use yii\queue\RetryableJobInterface;
class TestPush implements RetryableJobInterface
{
public $jobLogId;
public function execute($queue)
{
var_dump($queue->attempts, $queue->ttr);
echo '123123213213' , "\n";
throw new \Exception(date("Y-m-d H:i:s"));
}
public function getTtr()
{
return 30;
}
public function canRetry($attempt, $error)
{
echo $attempt. " ============ canRetry \n";
return true;
}
}
output
2019-09-05 09:36:22 [5d70615ba9a845.54703703] backend\job\TestPush (attempt: 1) - Started
/var/www/html/privateFund/trunk/backend/job/TestPush.php:12:
int(1)
/var/www/html/privateFund/trunk/backend/job/TestPush.php:12:
int(300)
123123213213
1 ============ canRetry
2019-09-05 09:36:22 [5d70615ba9a845.54703703] backend\job\TestPush (attempt: 1) - Error (0.081 s)
> Exception: 2019-09-05 09:36:22
1 ============ canRetry
The attempt is always 1
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the TestPush example in backend/job/TestPush.php and the RetryableJobInterface implementation, then reproduce the reported output with Yii 2.0.15.1 and PHP 7.2.5. Trace why the attempt value remains 1 after the exception; done means retries advance as expected and the behavior is covered by an appropriate test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100