faster unpack without exceptions

This commit is contained in:
Nick Elser
2015-04-12 19:43:07 -07:00
parent a54b795e20
commit c0905fef91

View File

@@ -175,7 +175,9 @@ module Suo
end end
def deserialize_locks(val) def deserialize_locks(val)
MessagePack.unpack(val).map do |time, token| unpacked = (val.nil? || val == "") ? [] : MessagePack.unpack(val)
unpacked.map do |time, token|
[Time.at(time), token] [Time.at(time), token]
end end
rescue EOFError => _ rescue EOFError => _