From 3aad9ba273bd764f1b9258ebff847d20537d4203 Mon Sep 17 00:00:00 2001 From: Ben Word Date: Wed, 4 Mar 2026 09:14:04 -0600 Subject: [PATCH 1/2] Update queue docs with production deployment guidance Co-Authored-By: Claude Opus 4.6 --- .../creating-and-processing-laravel-queues.md | 55 ++++++++++++++++--- 1 file changed, 46 insertions(+), 9 deletions(-) diff --git a/acorn/creating-and-processing-laravel-queues.md b/acorn/creating-and-processing-laravel-queues.md index 7d209022..713792a6 100644 --- a/acorn/creating-and-processing-laravel-queues.md +++ b/acorn/creating-and-processing-laravel-queues.md @@ -1,5 +1,5 @@ --- -date_modified: 2025-09-29 00:00 +date_modified: 2026-03-04 00:00 date_published: 2025-09-29 00:00 description: Use Laravel's queue system in WordPress through Acorn. Process background jobs, handle async tasks, and schedule recurring operations efficiently. title: Creating and Processing Laravel Queues @@ -250,16 +250,53 @@ $ wp acorn queue:flush $ wp acorn queue:forget 5 ``` +## Running queues in production + +### Keeping the worker running with Supervisor + +In production, use a process monitor like [Supervisor](http://supervisord.org/) to keep the queue worker running permanently: + +```ini +[program:acorn-worker] +process_name=%(program_name)s_%(process_num)02d +command=wp acorn queue:work --sleep=3 --tries=3 --max-time=3600 +directory=/path/to/your/site +autostart=true +autorestart=true +stopasgroup=true +killasgroup=true +numprocs=1 +redirect_stderr=true +stdout_logfile=/path/to/your/site/worker.log +stopwaitsecs=3600 +``` -## Dispatching jobs +### Restarting workers during deployment -```php -// In a controller or WordPress hook -use App\Jobs\ProcessImageOptimization; +Long-running `queue:work` processes keep the application booted in memory, so they won't pick up code changes after a deployment. Use `queue:restart` to gracefully restart all workers: -// Dispatch immediately -ProcessImageOptimization::dispatch($attachmentId); +```bash +$ wp acorn queue:restart +``` + +This signals workers to exit after finishing their current job, allowing Supervisor to start fresh instances with the updated code. Add this to your deployment script to ensure workers always run the latest version of your code. + +### Pausing and resuming workers -// Dispatch with delay -ProcessImageOptimization::dispatch($attachmentId)->delay(now()->addMinutes(5)); +You can pause and resume queue processing without stopping the worker processes: + +```bash +# Pause processing +$ wp acorn queue:pause + +# Resume processing +$ wp acorn queue:resume +``` + +### Monitoring queue sizes + +Monitor queue sizes to detect backlogs: + +```bash +$ wp acorn queue:monitor ``` From f7d263ad1b7b9330cb3a94f2b871c5388c0e0050 Mon Sep 17 00:00:00 2001 From: Ben Word Date: Wed, 4 Mar 2026 09:15:35 -0600 Subject: [PATCH 2/2] Fix bash lint: split multi-command bash block Co-Authored-By: Claude Opus 4.6 --- acorn/creating-and-processing-laravel-queues.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/acorn/creating-and-processing-laravel-queues.md b/acorn/creating-and-processing-laravel-queues.md index 713792a6..341af1e0 100644 --- a/acorn/creating-and-processing-laravel-queues.md +++ b/acorn/creating-and-processing-laravel-queues.md @@ -285,11 +285,15 @@ This signals workers to exit after finishing their current job, allowing Supervi You can pause and resume queue processing without stopping the worker processes: +#### Pause processing + ```bash -# Pause processing $ wp acorn queue:pause +``` -# Resume processing +#### Resume processing + +```bash $ wp acorn queue:resume ```