16

Hi is it possible to run multiple Resque workers simultaneously in development? I found this bit of code, but not sure if it will work and how..

http://pastebin.com/9GKk8GwR

So far I am using the standard

bundle exec env rake resque:work QUEUE='*'

redis-server /usr/local/etc/redis.conf
Ismael Abreu
  • 16,443
  • 6
  • 61
  • 75
Stpn
  • 6,202
  • 7
  • 47
  • 94

2 Answers2

42

You need to add a COUNT environment variable and then change resque:work to resque:workers. For example, to start 3 workers:

bundle exec env rake resque:workers QUEUE='*' COUNT='3'
Dylan Markow
  • 123,080
  • 26
  • 284
  • 201
  • This is amazing! I've always had 3-5 separate console tabs open for with one worker in each. Now I can bunch them all into one tab. Thanks! – Daniel Bonnell Mar 02 '18 at 17:50
13

The only way I know how to do that, and I think it's a great way, it's using Foreman (same thing that heroku uses).

You define your processes in a file named Procfile like:

web:    bundle exec thin start -p $PORT
worker: bundle exec rake resque:work QUEUE=*
clock:  bundle exec rake resque:scheduler

And then you can start your app with just one command

foreman start

To start more than one process of one type it's like this:

foreman start -c worker=2

https://github.com/ddollar/foreman

http://blog.daviddollar.org/2011/05/06/introducing-foreman.html

Ismael Abreu
  • 16,443
  • 6
  • 61
  • 75