lib/bootsnap/load_path_cache/store.rb in bootsnap-0.2.12 vs lib/bootsnap/load_path_cache/store.rb in bootsnap-0.2.13
- old
+ new
@@ -1,8 +1,7 @@
require_relative '../explicit_require'
-Bootsnap::ExplicitRequire.with_gems('snappy') { require 'snappy' }
Bootsnap::ExplicitRequire.with_gems('msgpack') { require 'msgpack' }
Bootsnap::ExplicitRequire.from_rubylibdir('fileutils')
module Bootsnap
module LoadPathCache
@@ -56,21 +55,21 @@
end
end
def load_data
@data = begin
- MessagePack.load(Snappy.inflate(File.binread(@store_path)))
- rescue Errno::ENOENT, Snappy::Error
+ MessagePack.load(File.binread(@store_path))
+ rescue Errno::ENOENT, MessagePack::MalformedFormatError
{}
end
end
def dump_data
# Change contents atomically so other processes can't get invalid
# caches if they read at an inopportune time.
tmp = "#{@store_path}.#{(rand * 100000).to_i}.tmp"
FileUtils.mkpath(File.dirname(tmp))
- File.binwrite(tmp, Snappy.deflate(MessagePack.dump(@data)))
+ File.binwrite(tmp, MessagePack.dump(@data))
FileUtils.mv(tmp, @store_path)
end
end
end
end