Mercurial > public > queues
changeset 36:4ad156c4dbee
blpop returns a tuple (queue_name, item) on success, on timeout, None, we need to handle both cases.
author | btimby |
---|---|
date | Sun, 20 May 2012 01:49:11 +0000 |
parents | 9805eefcb58c |
children | e1298d634da4 |
files | queues/backends/redisd.py |
diffstat | 1 files changed, 4 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/queues/backends/redisd.py Sun May 20 01:08:16 2012 +0000 +++ b/queues/backends/redisd.py Sun May 20 01:49:11 2012 +0000 @@ -70,7 +70,10 @@ if block: # Redis requires an integer, so round a float UP to the nearest # int (0.1 -> 1). - m = self._connection.blpop(self.name, timeout=int(math.ceil(timeout))) + try: + m = self._connection.blpop(self.name, timeout=int(math.ceil(timeout)))[1] + except TypeError: + m = None else: m = self._connection.lpop(self.name) if m is None: