class Fluent::TailInput::TailWatcher::IOHandler
def on_notify
def on_notify begin lines = [] read_more = false begin while true if @buffer.empty? @io.read_nonblock(2048, @buffer) else @buffer << @io.read_nonblock(2048, @iobuf) end while line = @buffer.slice!(/.*?\n/m) lines << line end if lines.size >= MAX_LINES_AT_ONCE # not to use too much memory in case the file is very large read_more = true break end end rescue EOFError end unless lines.empty? @receive_lines.call(lines) @pe.update_pos(@io.pos - @buffer.bytesize) end end while read_more rescue $log.error $!.to_s $log.error_backtrace close end