Class: Fluent::Plugin::TailInput::TailWatcher::LineBufferTimerFlusher
- Inherits:
-
Object
- Object
- Fluent::Plugin::TailInput::TailWatcher::LineBufferTimerFlusher
- Defined in:
- lib/fluent/plugin/in_tail.rb
Instance Method Summary collapse
-
#initialize(log, flush_interval, &flush_method) ⇒ LineBufferTimerFlusher
constructor
A new instance of LineBufferTimerFlusher.
- #on_notify(tw) ⇒ Object
- #reset_timer ⇒ Object
Constructor Details
#initialize(log, flush_interval, &flush_method) ⇒ LineBufferTimerFlusher
Returns a new instance of LineBufferTimerFlusher.
767 768 769 770 771 772 |
# File 'lib/fluent/plugin/in_tail.rb', line 767 def initialize(log, flush_interval, &flush_method) @log = log @flush_interval = flush_interval @flush_method = flush_method @start = nil end |
Instance Method Details
#on_notify(tw) ⇒ Object
774 775 776 777 778 779 780 781 782 |
# File 'lib/fluent/plugin/in_tail.rb', line 774 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 ⇒ Object
784 785 786 |
# File 'lib/fluent/plugin/in_tail.rb', line 784 def reset_timer @start = Time.now end |