2

Please see the attached screenshot. On heavy tasks the queue is cancelled. Where do I set the timeout or remove it completely? Screenshot

3

Before you push the job to the queue you can specify the ttr (time to reserve) in order to prevent the job being cancelled after 300 seconds (the default).

Craft::$app->queue->ttr(3600);
Craft::$app->queue->push($myJob);

Alternatively, you can make your Job class implement RetryableJobInterface and then give it its own getTtr() method. See the docs that explain this.

class SomeJob extends \craft\queue\BaseJob implements RetryableJobInterface
{
    public function getTtr()
    {
        return 3600;
    }
}

Or via configuration config/app.php:

return [
    'components' => [
        'queue' => [
            'ttr' => 600,
        ],
    ],
];

Finally, you can also achieve this using the provided event handlers.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.