Method: Fluent::IdleEventDetector#start

Defined in:
lib/flydata/fluent-plugins/idle_event_detector.rb

#start(&block) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/flydata/fluent-plugins/idle_event_detector.rb', line 12

def start(&block)
  raise "block must be given" unless block_given?
  @callback = block
  stop if @thread
  @last_event_at = @timestamp = Time.current
  @is_absent = false

  @thread = Thread.new do
    loop do
      check_state
      sleep @check_interval
    end
  end
end