-
-
Notifications
You must be signed in to change notification settings - Fork 295
New issue
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
Redelivering #393
Comments
That was made intentionally not to halt the rest of the queue while re-trying a single task. That's desired behavior for the case with more than a single worker (or another case when order isn't important). I guess it can be made configurable... |
But in my example TestJob doesn't implement RetryableJobInterface. Why the library sends the task to the back of the queue? |
That's a good question. Since were talking about desired behavior of the job to be sent to the head of queue I've thought we're talking about retries. If there are no retries, why do you expect the job to re-enter queue at all? |
Because of this (https://www.rabbitmq.com/semantics.html#ordering):
As I said I pressed Ctrl+c to stop the queue worker (no exception were thrown). In this case, as I understand, the message must be returned to the head of the queue because of the closed channel and unacknowledged message. Also, I've done some debug. Indeed, the message returns to the head of the queue, but the library on the next launch marks the message as acknowledged and redelivers to the back of the queue. But if the job throws an exception the library works as expected. For example: class TestJob implements JobInterface
{
public $id;
public function execute($queue)
{
print "$this->id\n";
if ($this->id === 3) {
throw new \RuntimeException('Some error');
}
sleep(3);
}
} In this case, the task won't be redelivered to the queue as I assume the library marks the message as acknowledged. |
What steps will reproduce the problem?
yii queue/listen
and interrupt it by Ctrl+C.What's expected?
The failed task (since RabbitMQ 2.7.0 ) must go to the head of the queue to keep the order of the tasks (https://www.rabbitmq.com/semantics.html#ordering).
What do you get instead?
The failed task goes to the back of the queue.
Additional info
Command:
Job:
Output:
The text was updated successfully, but these errors were encountered: