Skip to content

Commit

Permalink
Fix reincarnation bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Koed00 committed Jul 6, 2015
1 parent d1d8245 commit 254d99e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions django_q/cluster.py
Expand Up @@ -180,6 +180,10 @@ def spawn_monitor(self):
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()
Expand Down Expand Up @@ -225,10 +229,10 @@ def guard(self):
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:
Expand Down

0 comments on commit 254d99e

Please sign in to comment.