From 03755186d6cb968d44d7eb04de3ed2d047180272 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 30 Nov 2010 15:46:36 -0800 Subject: hash: fix some settings for memory-only hash These have no finalizers. --- lib/metropolis/hash.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/metropolis/hash.rb') diff --git a/lib/metropolis/hash.rb b/lib/metropolis/hash.rb index 61b7199..fb4d272 100644 --- a/lib/metropolis/hash.rb +++ b/lib/metropolis/hash.rb @@ -20,7 +20,7 @@ module Metropolis::Hash end if @readonly extend Metropolis::Common::RO - else + elsif @path args = [ @db, @path, !!opts[:fsync] ] @clean_proc = Metropolis::Hash.finalizer_callback(args) ObjectSpace.define_finalizer(self, @clean_proc) @@ -28,7 +28,7 @@ module Metropolis::Hash end def close! - unless @readonly + if ! @readonly && ! @path.nil? @clean_proc.call ObjectSpace.undefine_finalizer(self) end -- cgit v1.2.3-24-ge0c7