From 33b7fe50ed9274cbe2c44821fdc330395bba85d6 Mon Sep 17 00:00:00 2001 From: Ilan Steemers Date: Tue, 7 Jul 2015 16:45:05 +0200 Subject: [PATCH] fix reincarnation bug without timeout set --- django_q/cluster.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/django_q/cluster.py b/django_q/cluster.py index f037449..d981b9f 100644 --- a/django_q/cluster.py +++ b/django_q/cluster.py @@ -193,7 +193,7 @@ class Sentinel(object): else: self.pool.remove(process) self.spawn_worker() - if int(process.timer.value) >= self.timeout: + if self.timeout and int(process.timer.value) >= self.timeout: # only need to terminate on timeout, otherwise we risk destabilizing the queues process.terminate() logger.warn(_("reincarnated worker {} after timeout").format(process.name)) @@ -205,6 +205,7 @@ class Sentinel(object): self.reincarnations += 1 def spawn_cluster(self): + self.pool = [] Stat(self).save() for i in range(self.pool_size): self.spawn_worker() @@ -282,7 +283,6 @@ class Sentinel(object): count += 1 # Final status Stat(self).save() - self.pool = [] def pusher(task_queue, e, list_key=Conf.Q_LIST, r=redis_client):