Merge pull request #3033 from s0undt3ch/issues/3032

Fix some "`NameError`s" introduced when fixing #3015. Fixes #3032.
This commit is contained in:
Thomas S Hatch 2012-12-27 08:49:28 -08:00
commit 72015b0034
2 changed files with 8 additions and 3 deletions

View File

@ -1001,7 +1001,8 @@ class LocalClient(object):
# When running tests, if self.events is not destroyed, we leak 2
# threads per test case which uses self.client
if hasattr(self, 'event'):
self.event.destroy()
# The call bellow will take care of calling 'self.event.destroy()'
del(self.event)
class FunctionWrapper(dict):

View File

@ -330,7 +330,7 @@ class Publisher(multiprocessing.Process):
pull_sock.setsockopt(zmq.LINGER, 2500)
pull_sock.close()
finally:
if self.context.closed is False:
if context.closed is False:
context.term()
@ -416,11 +416,15 @@ class ReqServer(object):
if self.clients.closed is False:
self.clients.setsockopt(zmq.LINGER, 2500)
self.clients.close()
if self.work_procs.closed is False:
if self.workers.closed is False:
self.workers.setsockopt(zmq.LINGER, 2500)
self.workers.close()
if self.context.closed is False:
self.context.term()
# Also stop the workers
for worker in self.work_procs:
if worker.is_alive() is True:
worker.terminate()
def __del__(self):
self.destroy()