Commit b9dafc01 authored by Jim Fulton's avatar Jim Fulton

Simplified close logic -- now that we've gotten rid of the global

client loop.  Now the _rpc_mgr close should take care of closing
cleanly.
parent 659d2762
......@@ -445,25 +445,18 @@ class ClientStorage(object):
logger.info("%s Waiting for cache verification to finish",
self.__name__)
def close(self, kill=False):
def close(self):
"Storage API: finalize the storage, releasing external resources."
if self._rpc_mgr is not None:
self._rpc_mgr.close()
self._rpc_mgr = None
if (self._connection is not None) and not kill:
event = threading.Event()
self._connection.trigger.pull_trigger(lambda: self._close(event))
event.wait(9)
else:
self._close()
_rpc_mgr = self._rpc_mgr
self._rpc_mgr = None
if _rpc_mgr is None:
return # already closed
def _close(self, event=None):
if self._connection is not None:
self._connection.register_object(None) # Don't call me!
self._connection.close()
self._connection = None
self._connection = None
_rpc_mgr.close()
self._tbuf.close()
if self._cache is not None:
self._cache.close()
......@@ -474,9 +467,6 @@ class ClientStorage(object):
if self._check_blob_size_thread is not None:
self._check_blob_size_thread.join()
if event is not None:
event.set()
_check_blob_size_thread = None
def _check_blob_size(self, bytes=None):
if self._blob_cache_size is None:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment