diff --git a/src/CLI/QueueCommand.php b/src/CLI/QueueCommand.php index 244f650..eac4d1c 100644 --- a/src/CLI/QueueCommand.php +++ b/src/CLI/QueueCommand.php @@ -106,11 +106,15 @@ public function status(array $args, array $assocArgs): void * default: 256 * --- * + * [--daemon] + * : Run the worker continuously as a daemon. + * * ## EXAMPLES * * wp queue work * wp queue work emails --limit=50 * wp queue work imports --memory=512 + * wp queue work --daemon --memory=256 * * @when after_wp_load */ @@ -128,6 +132,13 @@ public function work(array $args, array $assocArgs): void $worker = WPQueue::worker(); $worker->setMemoryLimit($memory); + if (isset($assocArgs['daemon'])) { + WP_CLI::log("Starting daemon worker for queue: {$queue}"); + $worker->daemon($queue); + + return; + } + $processed = 0; while ($processed < $limit) {