Question

Queue's not process on worker [AppPlatform]

Ok, I’ve been back and forth with support now 8 times and they don’t understand / see the issue.

  1. Webservice
  2. Worker
  3. Redis Database
  4. MySQL Database

1 and 2 have the same codebase and the same environment variables. The worker component has the following run command(s). It will start the worker process and will schedule the scheduler.

nohup php artisan queue:work --daemon &

while true; do
    echo "=> Running scheduler"
    php artisan schedule:run || true;
    echo "=> Sleeping for 60 seconds"
    sleep 60;
done

In the web service we have created a page to see the queue size. And we are sure that there are items in the queue.

When the worker is started, the jobs are not processed. When I go in the console of the worker and start the process manually, the process starts, but doesn’t process any of the jobs.

When I go into the web service and start the queue:work, it processes the jobs in the queue.

Same code base, (as this is grabbed from GitHub), same env variables. No errors, no logs nothing. The Redis connection seems to be fine.

And yes, the ENV var QUEUE_CONNECTION is set to redis on both applications.


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

You may want to try making a bash script with the commands to run, and using that as the run command.

Something like this:

worker.sh

#!/bin/bash
php artisan queue:work --daemon &

while true; do
    echo "=> Running scheduler"
    php artisan schedule:run || true;
    echo "=> Sleeping for 60 seconds"
    sleep 60;
done

And set the run command of the worker to worker.sh