Skip to content

Commit

Permalink
Fix for bug where failed queue job is not removed
Browse files Browse the repository at this point in the history
  • Loading branch information
Eddie Corrigall committed Jul 7, 2016
1 parent 0a53fad commit 4420314
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion rq_dashboard/web.py
Expand Up @@ -26,7 +26,7 @@
Queue, Worker,
cancel_job, get_failed_queue, pop_connection, push_connection, requeue_job
)
from rq.exceptions import NoSuchJobError
from rq.exceptions import NoSuchJobError, InvalidJobOperationError
from rq.job import JobStatus

blueprint = Blueprint(
Expand Down Expand Up @@ -182,6 +182,8 @@ def requeue_and_double_job_view(job_id):
raise NoSuchJobError(
'Job {} does not exist in failed queue'.format(job_id)
)
if fq.remove(job_id) == 0:
raise InvalidJobOperationError('Cannot requeue non-failed jobs')
# Reset the job state
job.set_status(JobStatus.QUEUED)
job.exc_info = None
Expand Down

0 comments on commit 4420314

Please sign in to comment.