stop : turn checker into false (callbacks not called anymore) shutdown : [-] close : [-] terminate: [-]
# File lib/fluent/plugin_helper/timer.rb, line 45 def initialize super @_timers = [] end
# File lib/fluent/plugin_helper/timer.rb, line 50 def start super @_timer_running = true end
# File lib/fluent/plugin_helper/timer.rb, line 55 def stop super @_timer_running = false end
# File lib/fluent/plugin_helper/timer.rb, line 60 def terminate super @_timers = [] end
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) end
# File lib/fluent/plugin_helper/timer.rb, line 41 def timer_running? defined?(@_timer_running) && @_timer_running end