From 254d99e63b0c49d8b91a5d863c94ef7f8989c283 Mon Sep 17 00:00:00 2001 From: Ilan Steemers Date: Mon, 6 Jul 2015 20:54:24 +0200 Subject: [PATCH] Fix reincarnation bug --- django_q/cluster.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/django_q/cluster.py b/django_q/cluster.py index bf2f821..0e45695 100644 --- a/django_q/cluster.py +++ b/django_q/cluster.py @@ -180,6 +180,10 @@ class Sentinel(object): return self.spawn_process(monitor, self.done_queue) def reincarnate(self, process): + """ + :param process: the process to reincarnate + :type process: Process or None + """ process.terminate() if process == self.monitor: self.monitor = self.spawn_monitor() @@ -225,10 +229,10 @@ class Sentinel(object): p.timer.value += 1 # Check Monitor if not self.monitor.is_alive(): - self.reincarnate(p) + self.reincarnate(self.monitor) # Check Pusher if not self.pusher.is_alive(): - self.reincarnate(p) + self.reincarnate(self.pusher) # Call scheduler once a minute (or so) counter += 1 if counter > 60: