From 8e24d3a92d25aa59e6f8af6b871b706d4e2ddc91 Mon Sep 17 00:00:00 2001 From: Javier Lopez Date: Mon, 16 May 2016 12:11:19 +0200 Subject: [PATCH] job.py: Fix cancel failure on failed queue --- rq/job.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/rq/job.py b/rq/job.py index bb61fc4..ce1894b 100644 --- a/rq/job.py +++ b/rq/job.py @@ -473,11 +473,13 @@ class Job(object): without worrying about the internals required to implement job cancellation. """ - from .queue import Queue + from .queue import Queue, get_failed_queue pipeline = self.connection._pipeline() if self.origin: - queue = Queue(name=self.origin, connection=self.connection) - queue.remove(self, pipeline=pipeline) + q = (get_failed_queue(connection=self.connection) + if self.is_failed + else Queue(name=self.origin, connection=self.connection)) + q.remove(self, pipeline=pipeline) pipeline.execute() def delete(self, pipeline=None, remove_from_queue=True):