lib/rocket_job/sliced/compressed_slice.rb in rocketjob-6.0.0.rc3 vs lib/rocket_job/sliced/compressed_slice.rb in rocketjob-6.0.0
- old
+ new
@@ -4,16 +4,13 @@
# Compress the records within a slice
class CompressedSlice < ::RocketJob::Sliced::Slice
private
def parse_records
- records = attributes.delete("records")
-
# Convert BSON::Binary to a string
- binary_str = records.data
-
- str = Zlib::Inflate.inflate(binary_str)
- @records = Hash.from_bson(BSON::ByteBuffer.new(str))["r"]
+ compressed_str = attributes.delete("records").data
+ decompressed_str = Zlib::Inflate.inflate(compressed_str)
+ @records = Hash.from_bson(BSON::ByteBuffer.new(decompressed_str))["r"]
end
def serialize_records
return [] if @records.nil? || @records.empty?