Skip to content

Queue Health Check

Johannes Ahrndt edited this page Oct 7, 2023 · 2 revisions

This check will provide information about the queue. It will periodically run a small queue job to determine how long the queue takes to complete that job. This way, you'll be alerted if the queue is running late or not at all.

However, this check requires an additional setup step.

Setup

Please schedule the Craft CLI command craft ohdear/queue-health/run to run every minute. Depending on your hosting provider setting up a Cron job might differ. Here's an example for Laravel Forge:

php /home/forge/yourdomain.com/craft ohdear/queue-health/run
# Set Frequency to "Every Minute"

Here is another example if you configure the Cron job directly on the server:

# Open the crontab file
crontab -e
# On a new line paste this, edit as required
* * * * * php /path/to/your/website/craft ohdear/queue-health/run
# Good luck exiting vi 🫡

Once the Cron job is set up, add the Queue Health Check to your Craft config. You might want to adjust the default job time.

# config/ohdear.php
return [
    'healthChecks' => [
        Check::queueHealth()->failWhenHealthJobTakesLongerThanMinutes(10),
        // other health checks
    ],
];