Resque multiple workers in development mode

后端 未结 2 702
醉酒成梦
醉酒成梦 2021-01-31 21:20

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/9GKk

2条回答
  •  遇见更好的自我
    2021-01-31 21:57

    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

提交回复
热议问题