I have a system running several kinds of jobs (Laravel 5.1 queues). I use database queue driver.
Supervisor makes sure 3 'instances' of queue:work
are running as a daemon all the time.
ps aux | grep queue
confirms this - three processes are waiting for jobs.
Sometimes I can see several job (without delay) records in the database table, but always only one of them has the reserved
flag set to 1.
What am I doing wrong?
Why 3 daemon workers are not taking care of other jobs in the queue?
How can I make sure more than one job can be done at the same time?
UPDATE:
I wrote a job that sleeps for 15 seconds and then dispatches three new jobs (same class).
I ran this on my dev server and it worked. Three jobs were reserved at the same time. Once one of them is dealt with - another is taken from the queue and reserved. The behaviour one would expect.
Finally I ran the same situation on my production server and it did not work. One reserved job at once even though the environment is similar, three queue:work processes live etc.
I then asked supervisord to restart the workers and it started working as well.
So: it does work this way. The problem is I don't know what might have been causing the issue I had and when does it happen? How do I avoid this and how do I know if it's fine now?