lib/xcflushd/runner.rb in xcflushd-1.0.0.rc2 vs lib/xcflushd/runner.rb in xcflushd-1.0.0
- old
+ new
@@ -95,10 +95,12 @@
break if time_remaining <= 0
sleep([MAX_IDLING_SIGNAL_LATENCY, time_remaining].min)
end
end
@logger.info('Exiting')
+ rescue SignalException => e
+ @logger.fatal("Received unhandled signal #{e.cause}, shutting down")
rescue Exception => e
@logger.fatal("Unhandled exception #{e.class}, shutting down: #{e.cause} - #{e}")
ensure
shutdown
end
@@ -155,11 +157,15 @@
end
end
def setup_sighandlers
@exit = false
- Signal.trap('EXIT') { @exit = true }
- Signal.trap('INT') { @exit = true }
+ ['HUP', 'USR1', 'USR2'].each do |sig|
+ Signal.trap(sig, "SIG_IGN")
+ end
+ ['EXIT', 'TERM', 'INT'].each do |sig|
+ Signal.trap(sig) { @exit = true }
+ end
end
end
end
end