# HG changeset patch # User btimby # Date 1337023377 0 # Node ID 22831bdce9fd607daf5e4c77a90a0797ed3a1194 # Parent c70414fbc552ed46d3f15fdc10bc50ae9a997bc9 Added timeouts for blocking mode diff -r c70414fbc552 -r 22831bdce9fd queues/backends/dummy.py --- a/queues/backends/dummy.py Thu Apr 26 14:49:46 2012 +0000 +++ b/queues/backends/dummy.py Mon May 14 19:22:57 2012 +0000 @@ -20,9 +20,9 @@ self.backend = 'dummy' self.name = name - def read(self, block=False): + def read(self, block=False, timeout=None): try: - message = self.queue.get(block=block) + message = self.queue.get(block=block, timeout=timeout) self.queue.task_done() return message except queue.Empty, e: diff -r c70414fbc552 -r 22831bdce9fd queues/backends/redisd.py --- a/queues/backends/redisd.py Thu Apr 26 14:49:46 2012 +0000 +++ b/queues/backends/redisd.py Mon May 14 19:22:57 2012 +0000 @@ -64,10 +64,10 @@ except redis.RedisError, e: raise QueueException, "%s" % e - def read(self, block=False): + def read(self, block=False, timeout=0): try: if block: - m = self._connection.blpop(self.name) + m = self._connection.blpop(self.name, timeout=timeout) else: m = self._connection.lpop(self.name) if m is None: