Sha256: 1e2401b22f6f6ad04fbd9b2cb91fc837ab253eba9f6d923967e78ca71153b077
Contents?: true
Size: 956 Bytes
Versions: 1
Compression:
Stored size: 956 Bytes
Contents
require 'resque' $HEROKU_WILL_TERMINATE_RESQUE = false Resque.class_eval do def self.heroku_will_terminate? !!$HEROKU_WILL_TERMINATE_RESQUE end end # https://github.com/resque/resque/issues/1559#issuecomment-310908574 Resque::Worker.class_eval do def unregister_signal_handlers trap('TERM') do $HEROKU_WILL_TERMINATE_RESQUE = true trap('TERM') do log_with_severity :info, "[resque-heroku] received second term signal, throwing term exception" trap('TERM') do log_with_severity :info, "[resque-heroku] third or more time receiving TERM, ignoring" end raise Resque::TermException.new("SIGTERM") end log_with_severity :info, "[resque-heroku] received first term signal from heroku, ignoring" end trap('INT', 'DEFAULT') begin trap('QUIT', 'DEFAULT') trap('USR1', 'DEFAULT') trap('USR2', 'DEFAULT') rescue ArgumentError end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
resque-heroku-signals-1.27.4.3 | lib/resque-heroku-signals.rb |