Module: CelluloidIOPGListener::UnlistenWrappers::WithoutTermination
- Defined in:
- lib/celluloid-io-pg-listener/unlisten_wrappers/without_termination.rb
Overview
When running in a Supervision::Container we don’t need the terminate.
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(base) ⇒ Object
6 7 8 |
# File 'lib/celluloid-io-pg-listener/unlisten_wrappers/without_termination.rb', line 6 def self.included(base) base.send(:include, CelluloidIOPGListener::Client) end |
Instance Method Details
#unlisten(channel) ⇒ Object
23 24 25 26 |
# File 'lib/celluloid-io-pg-listener/unlisten_wrappers/without_termination.rb', line 23 def unlisten(channel) stop_listening pg_connection.exec(%[UNLISTEN "#{channel}";]) end |
#unlisten_wrapper(channel, payload, &block) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/celluloid-io-pg-listener/unlisten_wrappers/without_termination.rb', line 10 def unlisten_wrapper(channel, payload, &block) if block_given? debug "Acting on payload: #{payload} on #{channel}" instance_eval(&block) else info "Not acting on payload: #{payload} on #{channel}" end rescue => e info "#{self.class}##{callback_method} disconnected from #{channel} via #{e.class} #{e.message}" unlisten(channel) raise end |