Class: Fluent::MonitorAgentInput::TimerWatcher
- Inherits:
-
Coolio::TimerWatcher
- Object
- Coolio::TimerWatcher
- Fluent::MonitorAgentInput::TimerWatcher
- Defined in:
- lib/fluent/plugin/in_monitor_agent.rb
Instance Method Summary collapse
-
#initialize(interval, log, &callback) ⇒ TimerWatcher
constructor
A new instance of TimerWatcher.
- #on_timer ⇒ Object
Constructor Details
#initialize(interval, log, &callback) ⇒ TimerWatcher
Returns a new instance of TimerWatcher.
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 |
# File 'lib/fluent/plugin/in_monitor_agent.rb', line 209 def initialize(interval, log, &callback) @callback = callback @log = log # Avoid long shutdown time @num_call = 0 if interval >= 10 min_interval = 10 @call_interval = interval / 10 else min_interval = interval @call_interval = 0 end super(min_interval, true) end |
Instance Method Details
#on_timer ⇒ Object
226 227 228 229 230 231 232 233 234 235 |
# File 'lib/fluent/plugin/in_monitor_agent.rb', line 226 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 |