Skip to content

Commit

Permalink
Tweak code for log throttling
Browse files Browse the repository at this point in the history
Signed-off-by: Hiroshi Hatake <hatake@calyptia.com>
  • Loading branch information
cosmo0920 committed May 11, 2021
1 parent 478b487 commit 338651e
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/fluent/plugin/in_tail.rb
Expand Up @@ -958,10 +958,12 @@ def handle_notify
limit_bytes_per_second_reached = (number_bytes_read >= @read_bytes_limit_per_second && @read_bytes_limit_per_second > 0)
@log.debug("reading file: #{@path}")
if @lines.size >= @read_lines_limit || limit_bytes_per_second_reached
# not to use too much memory in case the file is very large
read_more = true

read_more = false if limit_bytes_per_second_reached && need_to_get_out_for_log_ingestion_loop?(start_reading)
if limit_bytes_per_second_reached && need_to_get_out_for_log_ingestion_loop?(start_reading)
# Do nothing. Just get out from tailing loop.
else
# not to use too much memory in case the file is very large
read_more = true
end

break
end
Expand Down

0 comments on commit 338651e

Please sign in to comment.