class Nucleus::Adapters::TailStopper
The TailStopper
can be used to cancel a timer or an ongoing HTTP request, e.g. when the underlying connection was terminated.
Public Class Methods
new(polling, method_to_stop)
click to toggle source
# File lib/nucleus/core/adapter_extensions/tail_stopper.rb, line 8 def initialize(polling, method_to_stop) @polling = polling @method_to_stop = method_to_stop end
Public Instance Methods
stop()
click to toggle source
Stop the tailing @return [void]
# File lib/nucleus/core/adapter_extensions/tail_stopper.rb, line 15 def stop log.debug('Stop tail updates, connection was closed') begin @polling.method(@method_to_stop).call rescue log.debug('Ignore error while closing connection') end end