class Fluent::NewTailInput::TailWatcher::LineBufferTimerFlusher

Public Class Methods

new(log, flush_interval, &flush_method) click to toggle source
# File lib/fluent/plugin/in_tail.rb, line 739
def initialize(log, flush_interval, &flush_method)
  @log = log
  @flush_interval = flush_interval
  @flush_method = flush_method
  @start = nil
end

Public Instance Methods

on_notify(tw) click to toggle source
# File lib/fluent/plugin/in_tail.rb, line 746
def on_notify(tw)
  if @start && @flush_interval
    if Time.now - @start >= @flush_interval
      @flush_method.call(tw)
      tw.line_buffer = nil
      @start = nil
    end
  end
end
reset_timer() click to toggle source
# File lib/fluent/plugin/in_tail.rb, line 756
def reset_timer
  @start = Time.now
end