In Laravel Horizon, when you configure a supervisor with multiple queues, the order in which the queues are listed does matter. The worker will prioritize the queues based on the order they are specified in the configuration array. This means that if you have jobs in both the high-priority and low-priority queues, the worker will first attempt to process jobs from the high-priority queue before moving on to the low-priority queue.
Given your configuration:
'single-process-supervisor' => [
'connection' => 'redis',
'queue' => ['high-priority', 'low-priority'],
'balance' => 'simple',
'processes' => 1,
'tries' => 1,
'maxTime' => 60,
],
If there are 50 jobs in the low-priority queue and you dispatch 3 jobs to the high-priority queue, the worker will indeed pick up the jobs from the high-priority queue first, because it is listed first in the array. Once the high-priority queue is empty, the worker will continue processing jobs from the low-priority queue.
This approach is a common pattern for handling job prioritization in Laravel applications using Horizon. Just ensure that your job dispatching logic correctly assigns jobs to the appropriate queue based on their priority.