Empty the queue before deleteing the jobs, in case new jobs arrive

main
Mark Tozzi 11 years ago
parent 0713ad03c2
commit 5f6a1f0ac5

@ -65,9 +65,10 @@ class Queue(object):
def empty(self): def empty(self):
"""Removes all messages on the queue.""" """Removes all messages on the queue."""
for job in self.get_jobs(): job_list = self.get_jobs()
job.cancel()
self.connection.delete(self.key) self.connection.delete(self.key)
for job in job_list:
job.cancel()
def is_empty(self): def is_empty(self):
"""Returns whether the current queue is empty.""" """Returns whether the current queue is empty."""

Loading…
Cancel
Save