summaryrefslogtreecommitdiff
path: root/logutils/queue.py
diff options
context:
space:
mode:
authorVinay Sajip <vinay_sajip@yahoo.co.uk>2011-11-21 16:51:43 +0000
committerVinay Sajip <vinay_sajip@yahoo.co.uk>2011-11-21 16:51:43 +0000
commit465f7a7f2b30f233b0cfc611a6411f68f58c2732 (patch)
tree2e9ddeac830fd714573c957f89e34f6db9aca166 /logutils/queue.py
parent71908d6d93695bddee1c2a363aafbb0c530e893c (diff)
downloadlogutils-465f7a7f2b30f233b0cfc611a6411f68f58c2732.tar.gz
Made ready for 0.3.2.0.3.2
Diffstat (limited to 'logutils/queue.py')
-rw-r--r--logutils/queue.py11
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