Skip to content

Commit

Permalink
refactor some variable names
Browse files Browse the repository at this point in the history
Signed-off-by: Daijiro Fukuda <[email protected]>
  • Loading branch information
daipom committed Jun 12, 2024
1 parent 05e7caf commit 6c03717
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lib/fluent/plugin/in_tail.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1011,7 +1011,7 @@ def initialize(from_encoding, encoding, log, max_line_size=nil)
@buffer = ''.force_encoding(from_encoding)
@eol = "\n".encode(from_encoding).freeze
@max_line_size = max_line_size
@was_long_line = false
@skip_current_line = false
@log = log
end

Expand Down Expand Up @@ -1058,27 +1058,27 @@ def read_lines(lines)
idx = @buffer.index(@eol)

is_long_line = @max_line_size && (
rbuf.bytesize > @max_line_size || @was_long_line
@skip_current_line || rbuf.bytesize > @max_line_size
)

if is_long_line
@log.warn "received line length is longer than #{@max_line_size}"
@log.debug("skipped line: ") { convert(rbuf).chomp }
@was_long_line = false
@skip_current_line = false
has_skipped_line = true
next
end

lines << convert(rbuf)
end

is_long_line = @max_line_size && (
@buffer.bytesize > @max_line_size || @was_long_line
is_long_current_line = @max_line_size && (
@skip_current_line || @buffer.bytesize > @max_line_size
)

if is_long_line
if is_long_current_line
@buffer.clear
@was_long_line = true
@skip_current_line = true
end

return has_skipped_line
Expand Down

0 comments on commit 6c03717

Please sign in to comment.