mirror of
https://github.com/django-q2/django-q2.git
synced 2026-10-07 21:58:11 +08:00
Fix reincarnation bug
This commit is contained in:
+6
-2
@@ -180,6 +180,10 @@ class Sentinel(object):
|
|||||||
return self.spawn_process(monitor, self.done_queue)
|
return self.spawn_process(monitor, self.done_queue)
|
||||||
|
|
||||||
def reincarnate(self, process):
|
def reincarnate(self, process):
|
||||||
|
"""
|
||||||
|
:param process: the process to reincarnate
|
||||||
|
:type process: Process or None
|
||||||
|
"""
|
||||||
process.terminate()
|
process.terminate()
|
||||||
if process == self.monitor:
|
if process == self.monitor:
|
||||||
self.monitor = self.spawn_monitor()
|
self.monitor = self.spawn_monitor()
|
||||||
@@ -225,10 +229,10 @@ class Sentinel(object):
|
|||||||
p.timer.value += 1
|
p.timer.value += 1
|
||||||
# Check Monitor
|
# Check Monitor
|
||||||
if not self.monitor.is_alive():
|
if not self.monitor.is_alive():
|
||||||
self.reincarnate(p)
|
self.reincarnate(self.monitor)
|
||||||
# Check Pusher
|
# Check Pusher
|
||||||
if not self.pusher.is_alive():
|
if not self.pusher.is_alive():
|
||||||
self.reincarnate(p)
|
self.reincarnate(self.pusher)
|
||||||
# Call scheduler once a minute (or so)
|
# Call scheduler once a minute (or so)
|
||||||
counter += 1
|
counter += 1
|
||||||
if counter > 60:
|
if counter > 60:
|
||||||
|
|||||||
Reference in New Issue
Block a user