Requeue should not error when called on a deleted job ID.

main
Vincent Driessen 13 years ago
parent 7ef3b5ade8
commit fb587297f6

@ -237,7 +237,12 @@ class FailedQueue(Queue):
def requeue(self, job_id): def requeue(self, job_id):
"""Requeues the given job ID.""" """Requeues the given job ID."""
job = Job.fetch(job_id) try:
job = Job.fetch(job_id)
except NoSuchJobError:
# Silently ignore/remove this job and return (i.e. do nothing)
conn.lrem(self.key, job_id)
return
# Delete it from the FailedQueue (raise an error if that failed) # Delete it from the FailedQueue (raise an error if that failed)
if conn.lrem(self.key, job.id) == 0: if conn.lrem(self.key, job.id) == 0:

Loading…
Cancel
Save