I have a task that I want to run, but unfortunately I dont seem to be able to disable mod_gzip/mod_deflate on this server, so that task will not run in the background and causes the site to hang while processing the task.

Therefore, I have set the "runQueueAutomatically" config setting to false.

I want to trigger the task queue to run manually (via a cron job), but I'm not sure how. In Craft CMS 2 I could visit "/index.php?p=actions/tasks/runPendingTasks" as per the docs here https://docs.craftcms.com/v2/config-settings.html#runtasksautomatically but I can't find the same action for v3. Have gone through the docs and can't see it anywhere - can someone help?


1 Answer 1


Craft 3 default action to run the queue is

public function actionRun(): Response
    // Prep the response
    $response = Craft::$app->getResponse();
    $response->content = '1';

    // Make sure Craft is configured to run queues over the web
    if (!Craft::$app->getConfig()->getGeneral()->runQueueAutomatically) {
        return $response;

    // Make sure the queue isn't already running, and there are waiting jobs
    $queue = Craft::$app->getQueue();
    if ($queue->getHasReservedJobs() || !$queue->getHasWaitingJobs()) {
        return $response;

    // Attempt to close the connection if this is an Ajax request
    if (Craft::$app->getRequest()->getIsAjax()) {

    // Run the queue

    return $response;

So all you need is Craft::$app->getQueue()->run(). Every Craft 3 project comes with a default module so you can Enhancing a Craft CMS 3 Website with a Custom Module or if You Wanna Make a Craft 3 Plugin?

  • Thanks @Robin! This is extremely clear and helpful. Unless I am mis-reading this, I don't see how I would ever be able to call this just as an action by visiting example.com/actions/queue/run as I have to set the runQueueAutomatically config flag to false in order to prevent the queue from being run automatically, but the first thing this does is check that value is set to true. Seems very odd! However, since I can just call Craft::$app->getQueue()->run(), I can just make my own action for it instead.
    – Jai Redden
    Jul 31, 2018 at 10:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.