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
commit66013d7a6c8594d435e6d3ff0b468b51c40318b6 (patch)
tree3f8251fc600a63169282d66869ea8d82864b47f1 /logutils/queue.py
parentff08c6c2163075ea0d3a12c1c2a2e2d52bcc7bc7 (diff)
downloadlogutils-git-66013d7a6c8594d435e6d3ff0b468b51c40318b6.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