From 2e19b657380422b17ffa3aeb761c919d9404464a Mon Sep 17 00:00:00 2001 From: Luke Sneeringer Date: Tue, 4 Nov 2014 13:51:08 -0600 Subject: [PATCH] Fix for run_task_system --- awx/main/queue.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/awx/main/queue.py b/awx/main/queue.py index 21e84e3112..a543838ad0 100644 --- a/awx/main/queue.py +++ b/awx/main/queue.py @@ -52,13 +52,19 @@ class FifoQueue(object): """ self._queue_name = queue_name + def __len__(self): + """Return the length of the Redis list.""" + return redis.llen(self._queue_name) + def push(self, value): """Push a value onto the right side of the queue.""" redis.rpush(self._queue_name, json.dumps(value)) def pop(self): """Retrieve a value from the left side of the queue.""" - return json.loads(redis.lpop(self._queue_name)) + answer = redis.lpop(self._queue_name) + if answer: + return json.loads(answer) class PubSub(object):