Resque on Heroku cedar stack Worker count still exists after the worker terminate

假如想象 提交于 2019-12-09 18:29:39

问题


I have successfully run resque on heroku cedar stack and mount the interface on rails.

when I start the worker, Everything works fine. The worker process the job. But When i kill the worker, Resque still think that the worker is available. When I start another worker, it then think there are 2 worker but in fact there is only one running.

I also notice form here http://devcenter.heroku.com/articles/ps that heroku send SIGTERM when killing a worker and if that does not terminate then it send SIGKILL.

here is my worker logs

2011-08-11T02:32:45+00:00 heroku[worker.1]: Starting process with command `bundle exec rake resque:work QUEUE=*`
2011-08-11T02:32:46+00:00 heroku[worker.1]: State changed from starting to up
2011-08-11T02:33:58+00:00 heroku[worker.1]: State changed from up to stopping
2011-08-11T02:34:00+00:00 heroku[worker.1]: Stopping process with SIGTERM
2011-08-11T02:34:09+00:00 heroku[worker.1]: Error R12 (Exit timeout) -> Process failed to exit within 10 seconds of SIGTERM
2011-08-11T02:34:09+00:00 heroku[worker.1]: Stopping process with SIGKILL
2011-08-11T02:34:11+00:00 heroku[worker.1]: Process exited

I see that my process takes more then 10s to terminate. Is this have anything to do because I load up rails environment on the worker task ?

this is my rake task lib/tasks/resque.rake

require "resque/tasks"

task "resque:setup"  => :environment

回答1:


I just found out the problem, this happend when passing ENV on the rake task. like when passing QUEUE='*'.

Here is the issue more complete https://github.com/defunkt/resque/issues/319#issuecomment-1789239

and the issue are still in discus at https://github.com/defunkt/resque/issues/368

any my temporary patch, that make resque only run all que.

https://github.com/yulrizka/resque




回答2:


ahmy,

Based on your solution, I came up with one that doesn't involve forking resque.

I put this in resque.rake:

task "resque:setup" => :environment do
  ENV['QUEUE'] = '*'
end

and put this in the Profile:

worker:  bundle exec rake resque:work

and put this in the Gemfile:

gem 'resque', :git => 'git://github.com/defunkt/resque.git'


来源:https://stackoverflow.com/questions/7020943/resque-on-heroku-cedar-stack-worker-count-still-exists-after-the-worker-terminat

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!