module Fluent::PluginHelper::Timer
Attributes
_timers[R]
stop : turn checker into false (callbacks not called anymore) shutdown : [-] close : [-] terminate: [-]
Public Class Methods
new()
click to toggle source
Calls superclass method
Fluent::PluginHelper::EventLoop::new
# File lib/fluent/plugin_helper/timer.rb, line 46 def initialize super @_timers = [] end
Public Instance Methods
start()
click to toggle source
Calls superclass method
Fluent::PluginHelper::EventLoop#start
# File lib/fluent/plugin_helper/timer.rb, line 51 def start super @_timer_running = true end
stop()
click to toggle source
Calls superclass method
# File lib/fluent/plugin_helper/timer.rb, line 56 def stop super @_timer_running = false end
terminate()
click to toggle source
Calls superclass method
Fluent::PluginHelper::EventLoop#terminate
# File lib/fluent/plugin_helper/timer.rb, line 61 def terminate super @_timers = [] end
timer_execute(title, interval, repeat: true, &block)
click to toggle source
interval: integer/float, repeat: true/false
# File lib/fluent/plugin_helper/timer.rb, line 32 def timer_execute(title, interval, repeat: true, &block) raise ArgumentError, "BUG: title must be a symbol" unless title.is_a? Symbol raise ArgumentError, "BUG: block not specified for callback" unless block_given? checker = ->(){ @_timer_running } timer = TimerWatcher.new(title, interval, repeat, log, checker, &block) @_timers << title event_loop_attach(timer) timer end
timer_running?()
click to toggle source
# File lib/fluent/plugin_helper/timer.rb, line 42 def timer_running? defined?(@_timer_running) && @_timer_running end