Search code examples
ruby-on-railsherokuresque

Heroku worker skips Resque's queue configuration?


In my Procfile I'm defining a worker like:

signup_worker: env QUEUE=signups bundle exec rake resque:work
login_worker: env QUEUE=logins bundle exec rake resque:work

but after deploy my code, my signup worker keeps processing both signups and logins.

Am I doing something wrong here? Is that possible to do on Heroku?


Solution

  • The problem here is that you're trying to pass an environment variable to your worker process, but you're using the wrong syntax.

    Update your Procfile to look like this:

    signup_worker: QUEUE=signups bundle exec rake resque:work
    login_worker: QUEUE=logins bundle exec rake resque:work
    

    If you want to pass an environment variable to a process inline, you need to do it in the form VARIABLE=value <command>.

    I tested this out myself on a dyno just now, and it works great!