Skip to content

Commit f0f75cf

Browse files
committed
fix: prevent data to be re-sent when closing connection
1 parent b64c3f8 commit f0f75cf

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/fluent/logger/fluent_logger.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -225,15 +225,15 @@ def write(msg)
225225
end
226226

227227
begin
228-
send_data(@pending)
228+
data_to_send = @pending
229229
@pending = nil
230+
send_data(data_to_send)
230231
true
231232
rescue => e
232233
set_last_error(e)
233234
if pending_bytesize > @limit
234235
@logger.error("FluentLogger: Can't send logs to #{connection_string}: #{$!}")
235-
call_buffer_overflow_handler(@pending)
236-
@pending = nil
236+
call_buffer_overflow_handler(data_to_send)
237237
end
238238
@con.close if connect?
239239
@con = nil

0 commit comments

Comments
 (0)