Rails + How do I assign dedicated workers to Resque queues?

65 Views Asked by At

Here, trying to assign dedicated workers to specific queues in Resque.

For example - 2 Workers are dedicated to default Queue, and 4 dedicated workers to the high queue.

resque-queues

Here, 16 workers to dedicated queues and the remaining 4 workers to any of the queues.

1

There are 1 best solutions below

0
widjajayd On

I'm using resque as background job for my rails app

here my answer probably can help you

cd /rails_app/

RAILS_ENV=production rake resque:work QUEUE='default' BACKGROUND=yes 
RAILS_ENV=production rake resque:work QUEUE='default' BACKGROUND=yes 
typing 2 times command above will run 2 worker for specific queue

RAILS_ENV=production rake resque:work QUEUE='high' BACKGROUND=yes 
type 4 times if you want to run this queue with 4 workers

additional notes

queue name also can be use for order job as priority for example I have 01_high, 02_default, 03_low and I run the worker as command below

RAILS_ENV=production rake resque:work QUEUE='*' BACKGROUND=yes

number 01_high has higher priority, it will process 02_default until 01_high finished