Class: Fluent::TailInput::TailWatcher::LineBufferTimerFlusher
- Inherits:
-
Object
- Object
- Fluent::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.
693 694 695 696 697 698 |
# File 'lib/fluent/plugin/in_tail.rb', line 693 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
700 701 702 703 704 705 706 707 708 |
# File 'lib/fluent/plugin/in_tail.rb', line 700 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
710 711 712 |
# File 'lib/fluent/plugin/in_tail.rb', line 710 def reset_timer @start = Time.now end |