yii2-queue
yii2-queue copied to clipboard
Ability to take off reserve from job
Can we add functionality to take off reserve from job to make it immediately available for workers? After job being reserved we need to wait TTR before job expired and moved back to waiting list to start new attempt. Also i found in documentation dirty workaround for this problem:
Yii::$app->queue->on(Queue::EVENT_AFTER_ERROR, function ($event) {
if ($event->error instanceof TemporaryUnprocessableJobException) {
$queue = $event->sender;
$queue->delay(7200)->push($event->job);
}
});
It works great but we are pushing New job with new ID attached to it so old one is lost and it makes mess in logs etc
Maybe we can add some release() method to handle it:
Yii::$app->queue->on(Queue::EVENT_AFTER_ERROR, function ($event) {
if ($event->error instanceof TemporaryUnprocessableJobException) {
$queue = $event->sender;
$queue->delay(7200)->release($event->job);
}
});
For an example in DB driver it's simply must reset reserved_at to null and update pushed_at to current time()
Beanstalk supports the release($id, $priority, $delay)
command for releasing a job back to the queue without changing its id.
(Just a note to illustrate that for some drivers this implementation would be really trivial)
@SamMousa thanks but i already implemented this with other needed features "dynamic channel", "parent queue", "queue title" etc...
In that case this can / should be closed? :)
@SamMousa i think it's must be implemented anyway...