Sha256: c460bbe60315a952dcdc1ad8666f6deeb1767ebd5e7d96362b91b294b4625118
Contents?: true
Size: 645 Bytes
Versions: 7
Compression:
Stored size: 645 Bytes
Contents
module EventBus class Daemon INTERRUPTION_SIGNALS = %w(TERM INT) def self.start Listeners::Manager.bind_all_listeners bind_signals end def self.stop EventBus::Config.broker.close_connection exit end def self.bind_signals read, write = IO.pipe INTERRUPTION_SIGNALS.each do |signal| Signal.trap(signal) { write.puts(signal) } end begin while io = IO.select([read]) signal = io.first[0].gets.strip raise Interrupt if INTERRUPTION_SIGNALS.include?(signal) end rescue Interrupt stop end end end end
Version data entries
7 entries across 7 versions & 1 rubygems