We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
<?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; } }
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
The text was updated successfully, but these errors were encountered:
Next try should increment $attempt. Can you share logs of two sequential tries of the same job?
$attempt
Sorry, something went wrong.
I used amqp deivers . The driver does not support retry. see yii2-queue/src/drivers/amqp/Queue.php:63
public function listen() { $this->open(); $callback = function (AMQPMessage $payload) { $id = $payload->get('message_id'); list($ttr, $message) = explode(';', $payload->body, 2); if ($this->handleMessage($id, $message, $ttr, 1)) { $payload->delivery_info['channel']->basic_ack($payload->delivery_info['delivery_tag']); } }; $this->channel->basic_qos(null, 1, null); $this->channel->basic_consume($this->queueName, '', false, false, false, false, $callback); while (count($this->channel->callbacks)) { $this->channel->wait(); } }
amqp_interop drivers can use retry but need to upgrade PHP version to 7.1.3.
No branches or pull requests
How do I use retry?
output
1 ============ canRetry
The attempt is always 1
The text was updated successfully, but these errors were encountered: