Class: Fluent::TDMonitorAgentInput::TimerWatcher
- Inherits:
-
Coolio::TimerWatcher
- Object
- Coolio::TimerWatcher
- Fluent::TDMonitorAgentInput::TimerWatcher
- Defined in:
- lib/fluent/plugin/in_td_monitor_agent.rb
Instance Method Summary collapse
-
#initialize(interval, repeat, log, &callback) ⇒ TimerWatcher
constructor
A new instance of TimerWatcher.
- #on_timer ⇒ Object
Constructor Details
#initialize(interval, repeat, log, &callback) ⇒ TimerWatcher
Returns a new instance of TimerWatcher.
34 35 36 37 38 39 40 41 |
# File 'lib/fluent/plugin/in_td_monitor_agent.rb', line 34 def initialize(interval, repeat, log, &callback) @callback = callback # Avoid long shutdown time @num_call = 0 @call_interval = interval / 10 @log = log super(10, repeat) end |
Instance Method Details
#on_timer ⇒ Object
43 44 45 46 47 48 49 50 51 52 |
# File 'lib/fluent/plugin/in_td_monitor_agent.rb', line 43 def on_timer @num_call += 1 if @num_call >= @call_interval @num_call = 0 @callback.call end rescue => e @log.error e.to_s @log.error_backtrace end |