From 4fb59a4ceb55cdfb0c283e4a68d672e7a6f22af4 Mon Sep 17 00:00:00 2001 From: Javier Lopez Date: Mon, 24 Aug 2015 17:46:16 +0200 Subject: [PATCH] Ensure custom exception handlers calls when Redis is down --- rq/worker.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/rq/worker.py b/rq/worker.py index 8176b27..e0c10f3 100644 --- a/rq/worker.py +++ b/rq/worker.py @@ -590,7 +590,12 @@ class Worker(object): except Exception: job.set_status(JobStatus.FAILED, pipeline=pipeline) started_job_registry.remove(job, pipeline=pipeline) - pipeline.execute() + try: + pipeline.execute() + except Exception: + # Ensure that custom exception handlers are called + # even if Redis is down + pass self.handle_exception(job, *sys.exc_info()) return False