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.
758 759 760 761 762 763 |
# File 'lib/fluent/plugin/in_tail.rb', line 758 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
765 766 767 768 769 770 771 772 773 |
# File 'lib/fluent/plugin/in_tail.rb', line 765 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
775 776 777 |
# File 'lib/fluent/plugin/in_tail.rb', line 775 def reset_timer @start = Time.now end |