|
39 | 39 | - [Queue Priorities](#queue-priorities) |
40 | 40 | - [Queue Workers and Deployment](#queue-workers-and-deployment) |
41 | 41 | - [Job Expirations and Timeouts](#job-expirations-and-timeouts) |
| 42 | + - [Pausing and Resuming Queue Workers](#pausing-and-resuming-queue-workers) |
42 | 43 | - [Supervisor Configuration](#supervisor-configuration) |
43 | 44 | - [Dealing With Failed Jobs](#dealing-with-failed-jobs) |
44 | 45 | - [Cleaning Up After Failed Jobs](#cleaning-up-after-failed-jobs) |
@@ -2291,6 +2292,27 @@ The `retry_after` configuration option and the `--timeout` CLI option are differ |
2291 | 2292 | > [!WARNING] |
2292 | 2293 | > The `--timeout` value should always be at least several seconds shorter than your `retry_after` configuration value. This will ensure that a worker processing a frozen job is always terminated before the job is retried. If your `--timeout` option is longer than your `retry_after` configuration value, your jobs may be processed twice. |
2293 | 2294 |
|
| 2295 | +<a name="pausing-and-resuming-queue-workers"></a> |
| 2296 | +### Pausing and Resuming Queue Workers |
| 2297 | + |
| 2298 | +Sometimes you may need to temporarily prevent a queue worker from processing new jobs without stopping the worker entirely. For example, you may want to pause job processing during system maintenance. Laravel provides the `queue:pause` and `queue:continue` Artisan commands to pause and resume queue workers. |
| 2299 | + |
| 2300 | +To pause a specific queue, provide the queue connection name and the queue name: |
| 2301 | + |
| 2302 | +```shell |
| 2303 | +php artisan queue:pause database:default |
| 2304 | +``` |
| 2305 | + |
| 2306 | +In this example, `database` is the queue connection name and `default` is the queue name. Once a queue is paused, any workers processing jobs from that queue will continue to finish their current job, but will not pick up any new jobs until the queue is resumed. |
| 2307 | + |
| 2308 | +To resume processing jobs on a paused queue, use the `queue:continue` command: |
| 2309 | + |
| 2310 | +```shell |
| 2311 | +php artisan queue:continue database:default |
| 2312 | +``` |
| 2313 | + |
| 2314 | +After resuming a queue, workers will begin processing new jobs from that queue immediately. Note that pausing a queue does not stop the worker process itself - it only prevents the worker from processing new jobs from the specified queue. |
| 2315 | + |
2294 | 2316 | <a name="supervisor-configuration"></a> |
2295 | 2317 | ## Supervisor Configuration |
2296 | 2318 |
|
|
0 commit comments