Resque on Heroku cedar stack Worker count still ex

2020-07-16 05:03发布

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

2条回答
孤傲高冷的网名
2楼-- · 2020-07-16 05:25

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'
查看更多
乱世女痞
3楼-- · 2020-07-16 05:37

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

查看更多
登录 后发表回答