Merge pull request #573 from jcsaaddupuy/feature/dequeue_any_not_recursive

dequeue_any not recursive
main
Selwin Ong 9 years ago
commit f09be523dd

@ -367,6 +367,7 @@ class Queue(object):
See the documentation of cls.lpop for the interpretation of timeout. See the documentation of cls.lpop for the interpretation of timeout.
""" """
while True:
queue_keys = [q.key for q in queues] queue_keys = [q.key for q in queues]
result = cls.lpop(queue_keys, timeout, connection=connection) result = cls.lpop(queue_keys, timeout, connection=connection)
if result is None: if result is None:
@ -377,8 +378,8 @@ class Queue(object):
job = cls.job_class.fetch(job_id, connection=connection) job = cls.job_class.fetch(job_id, connection=connection)
except NoSuchJobError: except NoSuchJobError:
# Silently pass on jobs that don't exist (anymore), # Silently pass on jobs that don't exist (anymore),
# and continue by reinvoking the same function recursively # and continue in the look
return cls.dequeue_any(queues, timeout, connection=connection) continue
except UnpickleError as e: except UnpickleError as e:
# Attach queue information on the exception for improved error # Attach queue information on the exception for improved error
# reporting # reporting
@ -386,6 +387,7 @@ class Queue(object):
e.queue = queue e.queue = queue
raise e raise e
return job, queue return job, queue
return None, None
# Total ordering defition (the rest of the required Python methods are # Total ordering defition (the rest of the required Python methods are
# auto-generated by the @total_ordering decorator) # auto-generated by the @total_ordering decorator)

Loading…
Cancel
Save