Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I'm setting up a separate cron job that just calls drush p-queue-work
however, I found that when there are no items in the queue, drush returns an exit code of 1 (error). This is problematic for systems which monitor the success or failure of cron runs, and it's not really an error.
Suggest returning a error code of 0 if there is nothing in the queue.
Comment | File | Size | Author |
---|---|---|---|
#3 | 2902179-3.patch | 1.16 KB | kim.pepper |
|
Comments
Comment #2
kim.pepperComment #3
kim.pepperNot sure what's going on there with closures and functions being called inside each other. It's quite confusing to read.
Here's my attempt at a patch.
Comment #4
nielsvm CreditAttribution: nielsvm as a volunteer and at Acquia commentedDuring the rewrite to Drush 9, the p:queue-work received a huge rewrite in order to work cleanly with the new
Symfony\Console
andSiteProcess
APIs. Unfortunately, callingpqw
without parameters will still fail hard and spawns a process fork!. So under Drush 9, this is what happens:However there's good news, because the now respected
--no-interaction
parameter does exactly what you need:While it still reports an error on empty queues, here the UNIX status code is always negative:
When using this, rely on your Drupal logs to detect failure.