使用 god + delayed_job是,不要使用 god的 keep_alive选项 ( don't use god's keep alive option when using god controlling delayed_jobs)

访问量: 1685

因为delayed_job有休眠时间。god会不断的唤醒它。。

God is always trying to start delayed_job every 5 seconds by default:

God's log file:

 23 ERROR: there is already one or more instance(s) of the program running
 24 ERROR: there is already one or more instance(s) of the program running
 25 ERROR: there is already one or more instance(s) of the program running
 26 ERROR: there is already one or more instance(s) of the program running
 27 ERROR: there is already one or more instance(s) of the program running
 28 ERROR: there is already one or more instance(s) of the program running
 29 ERROR: there is already one or more instance(s) of the program running
 30 ERROR: there is already one or more instance(s) of the program running

so the solution is simply don't use "keepalive=true" option.

RAILS_ROOT = '/sg552/workspace/m-api-cache-cleaner'
God.watch do |w| 
  w.name = 'cache_cleaner'
  w.dir = RAILS_ROOT
  w.start = "bundle exec bin/delayed_job start"
  w.log = "#{RAILS_ROOT}/log/cache_cleaner_stdout.log"
  # 不需要为 delayed_job 指定这个参数。因为delayed_job有休眠时间。god会不断的唤醒它。。
#  w.keepalive
end

订阅/RSS Feed

Subscribe

分类/category