I'm running artisan queue worker with pm2 and was thinking to run two artisan workers one that could process high priority queue, and the other would process low priotiry, long jobs.
The issue is that pm2 does not allow to run the same script as a separate instance.
I know that I can set priorities here --queue=live-high,live-low,default
, but my problem is that if low priority job takes 5 mins to complete, I need to be able to process high priority jobs meanwhile
From the Laravel Documentation:
Background Tasks
By default, multiple commands scheduled at the same time will execute sequentially. If you have long-running commands, this may cause subsequent commands to start much later than anticipated. If you would like to run commands in the background so that they may all run simultaneously, you may use the runInBackground method:
$schedule->command('analytics:report')
->daily()
->runInBackground();