Skip to content

Ability to take off reserve from job #228

Open
@acidka

Description

@acidka

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()

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions