Documentation
Increasing Craft's Queue TTR
If you're seeing an error that looks something like this...
The process "'/usr/local/bin/php' './craft' 'queue/exec' '123456789' '300' '1' '11' '--verbose=1' '--interactive=' '--color='" exceeded the timeout of 300 seconds
...then chances are you're hitting Craft's default 300 second time-to-run (TTR) queue limit. Fortunately, there's a couple ways you can increase it.
Note: the TTR of enqueued jobs is stored in Craft's queue database table. If you are re-running an existing job after increasing the TTR via one of the below methods, then the old TTR will still be used. To get around this you can either directly edit the TTR in the queue database table row, or enqueue a new job.
Via your config/app.php #
To change the default TTR of all jobs, add the following to your config/app.php, or merge it with any other existing config:
return [
'components' => [
'queue' => [
'ttr' => 600
],
],
];
Specify the TTR when enqueueing the job
If the job in question is enqueued by your own custom PHP code, then you should be able to specify the TTR when the job is enqueued.
$myJob = new MyJob();
Craft::$app->queue->ttr(600);
Craft::$app->queue->push($myJob);
Define a getTtr() method #
Finally, if your Job class implements RetryableJobInterface
then you should be able to define a getTtr method which returns a numerical TTL.
class MyJob extends \craft\queue\BaseJob implements RetryableJobInterface
{
public function getTtr()
{
return 600;
}
}