Class: Fluent::PingMessageInput

Inherits:
Input
  • Object
show all
Includes:
Mixin::ConfigPlaceholders
Defined in:
lib/fluent/plugin/in_ping_message.rb

Instance Method Summary collapse

Instance Method Details

#pingloopObject



38
39
40
41
42
43
44
45
46
47
# File 'lib/fluent/plugin/in_ping_message.rb', line 38

def pingloop
  @last_checked = Fluent::Engine.now
  loop do
    sleep 0.5
    if Fluent::Engine.now - @last_checked >= @interval
      @last_checked = Fluent::Engine.now
      router.emit(@tag, Fluent::Engine.now, {'data' => @data})
    end
  end
end

#shutdownObject



28
29
30
31
32
# File 'lib/fluent/plugin/in_ping_message.rb', line 28

def shutdown
  super
  @loop.terminate
  @loop.join
end

#startObject



23
24
25
26
# File 'lib/fluent/plugin/in_ping_message.rb', line 23

def start
  super
  start_pingloop
end

#start_pingloopObject



34
35
36
# File 'lib/fluent/plugin/in_ping_message.rb', line 34

def start_pingloop
  @loop = Thread.new(&method(:pingloop))
end