You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/5.x/reference/config/app.md
+22-2Lines changed: 22 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -429,7 +429,7 @@ Any changes you make to the Mailer component from `config/app.php` will not be r
429
429
430
430
### Queue
431
431
432
-
Craft’s job queue is powered by the [Yii2 Queue Extension](https://github.com/yiisoft/yii2-queue). By default, Craft will use a [custom queue driver](craft5:craft\queue\Queue) based on the extension’s [DB driver](https://github.com/yiisoft/yii2-queue/blob/master/docs/guide/driver-db.md).
432
+
Craft’s [queue](../../system/queue.md) is powered by the [Yii2 Queue Extension](https://github.com/yiisoft/yii2-queue). By default, Craft will use a [custom queue driver](craft5:craft\queue\Queue) based on the extension’s [DB driver](https://github.com/yiisoft/yii2-queue/blob/master/docs/guide/driver-db.md).
433
433
434
434
Switching to a different driver by overriding Craft’s `queue` component from `config/app.php` will result in a loss of visibility into the queue’s state from the control panel. Instead of replacing the entire component, set your custom queue driver config on <craft5:craft\queue\Queue::$proxyQueue>:
435
435
@@ -459,7 +459,27 @@ Only drivers that implement <craft5:craft\queue\QueueInterface> will be visible
459
459
:::
460
460
461
461
::: tip
462
-
If your queue driver supplies its own worker, set the <config5:runQueueAutomatically> config setting to `false` in `config/general.php`.
462
+
If your queue driver supplies its own [worker](../../system/queue.md#workers), set the <config5:runQueueAutomatically> config setting to `false` in `config/general.php`.
463
+
:::
464
+
465
+
For projects that spawn many long-running jobs (as is often the case when synchronizing content from other sources), you may wish to extend the default job `ttr` or _time to reserve_:
466
+
467
+
```php
468
+
469
+
return [
470
+
'components' => [
471
+
'queue' => [
472
+
// Allow individual jobs to run for 15 minutes:
473
+
'ttr' => 900,
474
+
],
475
+
],
476
+
];
477
+
```
478
+
479
+
This does not prevent plugins or modules from pushing jobs with a shorter `ttr`, but Craft will respect it for all built-in queue usage.
480
+
481
+
::: warning
482
+
[Daemonized queue runners](../../system/queue.md#daemon) should be configured to allow the full `ttr` duration before issuing a `KILL` signal.
Copy file name to clipboardExpand all lines: docs/5.x/requirements.md
+4-3Lines changed: 4 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -66,9 +66,10 @@ We recommend ImageMagick over GD for expanded [image handling options](developme
66
66
67
67
Some shared hosting environments disable common PHP methods and configurations that affect Craft features.
68
68
69
-
-[allow_url_fopen](http://php.net/manual/en/filesystem.configuration.php#ini.allow-url-fopen) must be enabled for updating and installing plugins from the Plugin Store.
70
-
-[proc_*](http://php.net/manual/en/ref.exec.php) methods must be enabled in order to utilize the Plugin Store, install updates, and send emails.
71
-
-[ignore_user_abort](https://www.php.net/manual/en/function.ignore-user-abort.php) must be enabled for the [default, web-based queue runner](config5:runQueueAutomatically) to operate.
69
+
-[allow_url_fopen](http://php.net/manual/en/filesystem.configuration.php#ini.allow-url-fopen) — This `ini` setting must be enabled to support updating and installing plugins from the Plugin Store.
70
+
-[proc_*](http://php.net/manual/en/ref.exec.php) — These methods are required in order to utilize the Plugin Store, install updates, and send emails.
71
+
-[ignore_user_abort](https://www.php.net/manual/en/function.ignore-user-abort.php) — Required when using the default [web-based queue runner](system/queue.md#http) to operate.
72
+
-[pcntl_*](https://www.php.net/manual/en/book.pcntl.php) — The _Process Control_ extension allows [daemonized queue runners](system/queue.md#daemon) to gracefully exit between jobs.
The `TimeoutStopSec` and `stopwaitsecs` settings in the examples above should agree with (or exceed) [your queue’s `ttr`](../reference/config/app.md#queue), so that currently-running jobs may complete and the runner may exit gracefully when the process manager sends a `TERM` signal. At the end of that window (if the queue has not voluntarily exited), the process manager sends a `KILL` signal and may interrupt the queue in the middle of a task. This safeguard relies on the [`pcntl` PHP extension](https://www.yiiframework.com/extension/yiisoft/yii2-queue/doc/guide/2.3/en/retryable), which is _not_ a core Craft [requirement](../requirements.md), and may need to be enabled by your host.
150
+
145
151
::: warning
146
152
Long-running processes must be restarted to pick up code and schema changes after a deployment or migration!
147
153
148
-
To register your newly created service, the process manager itself may need to be restarted, or specifically told to look for new configuration.
154
+
To register your newly created (or updated) service, the process manager itself may need to be restarted, or specifically told to look for new configuration.
149
155
:::
150
156
151
157
Your process manager also has commands for interacting with the service:
@@ -193,7 +199,7 @@ sudo systemctl status "craft-queue-worker@*"
193
199
sudo systemctl restart "craft-queue-worker@*"
194
200
```
195
201
196
-
This is possible due to the `@` symbol at the end of our service unit file’s name. Note that the bash “range” syntax (`{1..4}`) is _not_ surrounded by quotes, but the “glob” patterns (`*`) _are_. This is critical for the system to be able to expand and map the commands to the appropriate service instances(s).
202
+
This is possible due to the `@` symbol at the end of our service unit file’s name. Note that the bash-specific “range” syntax (`{1..4}`) is _not_ surrounded by quotes, but the “glob” patterns (`*`) _are_. This is critical for the system to be able to expand and map the commands to the appropriate service instances(s).
197
203
:::
198
204
199
205
These setup instructions ensure your service is started whenever the host machine is rebooted, but it’s important to check your work! If your host allows, consider manually rebooting your machine and verifying that the queue is active.
@@ -226,7 +232,7 @@ Do not run the queue as root!
226
232
227
233
## Local Development
228
234
229
-
If you’ve turned off <config5:runQueueAutomatically> for your live infrastructure, the queue will also be disabled in your local environment. You can [override](config/README.md#environment-overrides) the general config setting by declaring `CRAFT_RUN_QUEUE_AUTOMATICALLY=true` in your `.env`, or use the [CLI](#cli) as you would in a [daemon](#daemon):
235
+
If you’ve turned off <config5:runQueueAutomatically> for your live infrastructure, the queue will also be disabled in your local environment. You can [override](../configure.md#environment-overrides) the general config setting by declaring `CRAFT_RUN_QUEUE_AUTOMATICALLY=true` in your `.env`, or use the [CLI](#cli) as you would in a [daemon](#daemon):
0 commit comments