lib/logstash/outputs/s3.rb in logstash-output-s3-1.0.0 vs lib/logstash/outputs/s3.rb in logstash-output-s3-1.0.1
- old
+ new
@@ -282,11 +282,13 @@
@codec.encode(event)
end
public
def rotate_events_log?
- @tempfile.size > @size_file
+ @file_rotation_lock.synchronize do
+ @tempfile.size > @size_file
+ end
end
public
def write_events_to_multiple_files?
@size_file > 0
@@ -309,10 +311,12 @@
public
def teardown
shutdown_upload_workers
@periodic_rotation_thread.stop! if @periodic_rotation_thread
- @tempfile.close
+ @file_rotation_lock.synchronize do
+ @tempfile.close unless @tempfile.nil? && @tempfile.closed?
+ end
finished
end
private
def shutdown_upload_workers