Skip to content

Commit 0759c78

Browse files
ddukbgdaipom
andauthored
refactor: Simplify data compression logic
refactor: Simplify data compression logic Remove duplicate file reading and streamline compression process Co-authored-by: Daijiro Fukuda <fukuda@clear-code.com>
1 parent 5a4b255 commit 0759c78

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

lib/fluent/plugin/out_s3.rb

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -641,11 +641,7 @@ def content_type
641641
end
642642

643643
def compress(chunk, tmp)
644-
uncompressed_data = ''
645-
chunk.open do |io|
646-
uncompressed_data = io.read
647-
end
648-
compressed_data = Zstd.compress(uncompressed_data, level: @level)
644+
compressed_data = Zstd.compress(chunk.read, level: @level)
649645
tmp.write(compressed_data)
650646
rescue => e
651647
log.warn "zstd compression failed: #{e.message}"

0 commit comments

Comments
 (0)