Commit 09782dd8 by Julien Muchembled

tests: fix bugs when stopping threaded cluster

- Fix deadlock when client is in slave mode whereas a DB was open.
- Fix regression in commit b3b5175f
  ("tests: make it possible to run several threaded clusters at the same time").
1 parent 80a1426b
...@@ -482,7 +482,7 @@ class NEOCluster(object): ...@@ -482,7 +482,7 @@ class NEOCluster(object):
self.remote_addr = addr self.remote_addr = addr
def send(self, msg): def send(self, msg):
result = cls.SocketConnector_send(self, msg) result = cls.SocketConnector_send(self, msg)
if Serialized.pending is not None: if type(Serialized.pending) is not frozenset:
Serialized.pending = 1 Serialized.pending = 1
return result return result
# TODO: 'sleep' should 'tic' in a smart way, so that storages can be # TODO: 'sleep' should 'tic' in a smart way, so that storages can be
...@@ -617,6 +617,8 @@ class NEOCluster(object): ...@@ -617,6 +617,8 @@ class NEOCluster(object):
return db return db
def stop(self): def stop(self):
if hasattr(self, '_db') and self.client.em._timeout == 0:
self.client.setPoll(True)
self.__dict__.pop('_db', self.client).close() self.__dict__.pop('_db', self.client).close()
#self.neoctl.setClusterState(ClusterStates.STOPPING) # TODO #self.neoctl.setClusterState(ClusterStates.STOPPING) # TODO
try: try:
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!