Class: EventedBluepill::TriggerTimer

Inherits:
Coolio::TimerWatcher
  • Object
show all
Defined in:
lib/evented_bluepill/trigger.rb

Instance Method Summary collapse

Constructor Details

#initialize(trigger, event, delay) ⇒ TriggerTimer

Returns a new instance of TriggerTimer.



7
8
9
10
11
# File 'lib/evented_bluepill/trigger.rb', line 7

def initialize(trigger, event, delay)
  @trigger = trigger
  @event = event
  super(delay, false)
end

Instance Method Details

#on_timerObject



13
14
15
16
17
18
19
20
21
22
# File 'lib/evented_bluepill/trigger.rb', line 13

def on_timer
  begin
    @trigger.logger.info("Retrying from flapping")
    @trigger.dispatch!(@event)
    @trigger.remove_timer(self)
  rescue StandardError => e
    @trigger.logger.err(e)
    @trigger.logger.err(e.backtrace.join("\n"))
  end
end