Cloning the inbox thread

master
Bob Mottram 2019-09-03 11:24:15 +01:00
parent 2f85939c1d
commit ad5fb99ea7
2 changed files with 10 additions and 2 deletions

View File

@ -1140,11 +1140,13 @@ def runInboxQueueWatchdog(projectVersion: str,httpd) -> None:
"""This tries to keep the inbox thread running even if it dies
"""
print('Starting inbox queue watchdog')
inboxQueueOriginal=httpd.thrInboxQueue.clone()
httpd.thrInboxQueue.start()
while True:
time.sleep(20)
if not httpd.thrInboxQueue.isAlive():
httpd.thrInboxQueue.kill()
httpd.thrInboxQueue=inboxQueueOriginal.clone()
httpd.thrInboxQueue.start()
print('Restarting inbox queue...')

View File

@ -13,7 +13,8 @@ import time
class threadWithTrace(threading.Thread):
def __init__(self, *args, **keywords):
threading.Thread.__init__(self, *args, **keywords)
self._args, self._keywords = args, keywords
threading.Thread.__init__(self, *self._args, **self._keywords)
self.killed = False
def start(self):
@ -40,3 +41,8 @@ class threadWithTrace(threading.Thread):
def kill(self):
self.killed = True
def clone(self):
return threadWithTrace(target=self, \
args=(self._args, self._keywords),daemon=True)
#return threadWithTrace(self, *self._args, **self._keywords)