diff --git a/inbox.py b/inbox.py index 52eebc7c..4a088dce 100644 --- a/inbox.py +++ b/inbox.py @@ -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...') diff --git a/threads.py b/threads.py index d84926f7..a93734a3 100644 --- a/threads.py +++ b/threads.py @@ -12,8 +12,9 @@ import trace import time class threadWithTrace(threading.Thread): - def __init__(self, *args, **keywords): - threading.Thread.__init__(self, *args, **keywords) + def __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)