Skip to content

How to make repeated attempts with progressive delay? #143

Open
@paulzi

Description

@paulzi

I want to make each retry attempt each time more delayed. However, I could not do it, because there is no delay property in ErrorEvent:

Yii::$app->queue->on(Queue::EVENT_AFTER_ERROR, function (ErrorEvent $event) {
    if ($event->job instanceof SomeJob) {
        //$event->delay = $event->attempt * 30; // there I want to set delay based on attempt
        $event->retry = $event->attempt < 5;
    }
});

It would also be nice to add in the RetryableJob method getRetryDelay:

public function getRetryDelay($attempt, $error)
{
    return $attempt * 30;
}

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