Fix reincarnation bug

This commit is contained in:
Ilan Steemers
2015-07-06 20:54:24 +02:00
parent d1d8245ad2
commit 254d99e63b
+6 -2
View File
@@ -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: