class Fluent::PluginHelper::Timer::TimerWatcher
Public Class Methods
new(title, interval, repeat, log, checker, &callback)
click to toggle source
Calls superclass method
# File lib/fluent/plugin_helper/timer.rb, line 67 def initialize(title, interval, repeat, log, checker, &callback) @title = title @callback = callback @repeat = repeat @log = log @checker = checker super(interval, repeat) end
Public Instance Methods
on_timer()
click to toggle source
# File lib/fluent/plugin_helper/timer.rb, line 76 def on_timer @callback.call if @checker.call rescue => e @log.error "Unexpected error raised. Stopping the timer.", title: @title, error: e @log.error_backtrace detach @log.error "Timer detached.", title: @title ensure if attached? detach unless @repeat end end