diff options
author | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2011-11-21 16:51:43 +0000 |
---|---|---|
committer | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2011-11-21 16:51:43 +0000 |
commit | 465f7a7f2b30f233b0cfc611a6411f68f58c2732 (patch) | |
tree | 2e9ddeac830fd714573c957f89e34f6db9aca166 /logutils/queue.py | |
parent | 71908d6d93695bddee1c2a363aafbb0c530e893c (diff) | |
download | logutils-465f7a7f2b30f233b0cfc611a6411f68f58c2732.tar.gz |
Made ready for 0.3.2.0.3.2
Diffstat (limited to 'logutils/queue.py')
-rw-r--r-- | logutils/queue.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/logutils/queue.py b/logutils/queue.py index 03ed570..39be637 100644 --- a/logutils/queue.py +++ b/logutils/queue.py @@ -214,6 +214,15 @@ class QueueListener(object): except queue.Empty: break + def enqueue_sentinel(self): + """ + Writes a sentinel to the queue to tell the listener to quit. This + implementation uses ``put_nowait()``. You may want to override this + method if you want to use timeouts or work with custom queue + implementations. + """ + self.queue.put_nowait(self._sentinel) + def stop(self): """ Stop the listener. @@ -223,7 +232,7 @@ class QueueListener(object): may be some records still left on the queue, which won't be processed. """ self._stop.set() - self.queue.put_nowait(self._sentinel) + self.enqueue_sentinel() self._thread.join() self._thread = None |