From 1ebf8804024a263a85e1c9af5a7ca3266b531012 Mon Sep 17 00:00:00 2001 From: fate0 Date: Fri, 12 May 2017 18:21:11 +0800 Subject: [PATCH] fix uncaught StopRequested during send heartbeat --- rq/worker.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/rq/worker.py b/rq/worker.py index c364b18..3efcd6d 100644 --- a/rq/worker.py +++ b/rq/worker.py @@ -466,15 +466,15 @@ class Worker(object): if burst: self.log.info("RQ worker {0!r} done, quitting".format(self.key)) break + + job, queue = result + self.execute_job(job, queue) + self.heartbeat() + + did_perform_work = True + except StopRequested: break - - job, queue = result - self.execute_job(job, queue) - self.heartbeat() - - did_perform_work = True - finally: if not self.is_horse: self.register_death()