Merge pull request #324 from chmduquesne/master

Properly destroying the objects that contain daemonized threads
This commit is contained in:
Dana Powers
2015-03-02 17:49:07 -08:00
2 changed files with 9 additions and 0 deletions

View File

@@ -127,6 +127,7 @@ class Producer(object):
self.async = async
self.req_acks = req_acks
self.ack_timeout = ack_timeout
self.stopped = False
if codec is None:
codec = CODEC_NONE
@@ -212,3 +213,8 @@ class Producer(object):
if self.proc.is_alive():
self.proc.terminate()
self.stopped = True
def __del__(self):
if not self.stopped:
self.stop()

View File

@@ -151,3 +151,6 @@ class ReentrantTimer(object):
# noinspection PyAttributeOutsideInit
self.timer = None
self.fn = None
def __del__(self):
self.stop()