module PgNotifier
Constants
- VERSION
Public Class Methods
configure(&block)
click to toggle source
# File lib/pg_notifier.rb, line 35 def configure(&block) manager.tap(&block) end
manager()
click to toggle source
# File lib/pg_notifier.rb, line 8 def manager @manager ||= Manager.new end
notify(channel, options = {}, &block)
click to toggle source
# File lib/pg_notifier.rb, line 31 def notify(channel, options = {}, &block) manager.notify(channel, options, &block) end
run()
click to toggle source
# File lib/pg_notifier.rb, line 12 def run sig_read, sig_write = IO.pipe (%w[INT TERM HUP] & Signal.list.keys).each do |sig| trap sig do sig_write.puts(sig) end end manager.run while io = IO.select([sig_read]) sig = io.first[0].gets.chomp manager.logger.debug "Got #{sig} signal" manager.shutdown if %w[INT TERM HUP].include? sig end end