Skip to content

Commit

Permalink
in_tail: reduce the lifespan of the buffer area
Browse files Browse the repository at this point in the history
Signed-off-by: Shizuo Fujita <[email protected]>
  • Loading branch information
Watson1978 committed Jan 9, 2025
1 parent 5080f81 commit a7eb00c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/fluent/plugin/in_tail.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1119,7 +1119,6 @@ def initialize(watcher, path:, read_lines_limit:, read_bytes_limit_per_second:,
@receive_lines = receive_lines
@open_on_every_update = open_on_every_update
@fifo = FIFO.new(from_encoding || Encoding::ASCII_8BIT, encoding || Encoding::ASCII_8BIT, log, max_line_size)
@iobuf = ''.force_encoding('ASCII-8BIT')
@lines = []
@io = nil
@notify_mutex = Mutex.new
Expand Down Expand Up @@ -1201,6 +1200,7 @@ def handle_notify
end

with_io do |io|
iobuf = ''.force_encoding('ASCII-8BIT')
begin
read_more = false
has_skipped_line = false
Expand All @@ -1211,7 +1211,7 @@ def handle_notify
@start_reading_time ||= Fluent::Clock.now
group_watcher&.update_reading_time(@path)

data = io.readpartial(BYTES_TO_READ, @iobuf)
data = io.readpartial(BYTES_TO_READ, iobuf)
@eof = false
@number_bytes_read += data.bytesize
@fifo << data
Expand Down

0 comments on commit a7eb00c

Please sign in to comment.