Sha256: 5dfb4884af3c19cafd448ef0543e864d544aa89155de48e0dbdf2a66233c4277

Contents?: true

Size: 804 Bytes

Versions: 1

Compression:

Stored size: 804 Bytes

Contents

require 'resque'
require "resque/heroku/version"

# https://github.com/resque/resque/issues/1559#issuecomment-310908574
Resque::Worker.class_eval do
  def unregister_signal_handlers
    trap('TERM') do
      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.1 lib/resque/heroku-signals.rb