Scott Watermasysk

Still Learning to Code

One Rake Task for Multiple Resque Workers

First, here is a nice blog post by Les Hill on running both Resque Scheduler and regular Resque workers on Heroku (on the cheap :).

One frustrating thing about this setup was manually starting each instance of resque (I needed at least 2; 1 for the scheduler and 1 to do work) for local development. A little googling around led me to this very helpful gist, Rake task to launch multiple Resque workers, by Karel Minarik.

I changed line number 133 to use my “jobs:work” task which always starts the scheduler first, but everything else works as is.

Now, all I need to do is execute rake workers:start and I get three instances of resque running (1 scheduler and 2 workers).

UPDATE: Looks like I edited out the part of this post which mentions this is for local development. The AutoScale code in Les’s post takes care of this in production (on Heroku).