diff --git a/rq/local.py b/rq/local.py index a461a9f..e789c81 100644 --- a/rq/local.py +++ b/rq/local.py @@ -161,7 +161,10 @@ class LocalStack(object): return None def __len__(self): - return len(self._local.stack) + stack = getattr(self._local, 'stack', None) + if stack is None: + return 0 + return len(stack) class LocalManager(object):