O
O
online_consult7772020-07-03 13:05:50
Redis
online_consult777, 2020-07-03 13:05:50

How to assign the maximum number of workers for a specific job type?

Good day everyone!

How can I implement the following task:

Some types of jobs should be processed by a maximum
of a certain number of workers

For example: there are 100 jobs in the queue.
20 of them with type 1, 30 with type 2, 50 with type 3.

with type 1 max 10 workers can work
with type 2 max 50 workers
with type 3 max 100 workers

Currently using laravel, for redis + horizon queues.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
online_consult777, 2020-07-06
@online_consult777

This does not cover my case 100%, but suddenly it will come in handy for someone:
Three types of queues are created with min and max number of processes.

'environments' => [
    'production' => [
        'supervisor-1' => [
            'connection' => 'redis',
            'queue' => ['queue-one'],
            'balance' => 'auto',
            'minProcesses' => 1,
            'maxProcesses' => 10,
            'tries' => 3,
        ],
        'supervisor-2' => [
            'connection' => 'redis',
            'queue' => ['queue-two'],
            'balance' => 'auto',
            'minProcesses' => 1,
            'maxProcesses' => 5,
            'tries' => 3,
        ],
        'supervisor-3' => [
            'connection' => 'redis',
            'queue' => ['queue-three'],
            'balance' => 'auto',
            'minProcesses' => 1,
            'maxProcesses' => 1,
            'tries' => 3,
        ],
    ],
],

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question