mirror of https://gitlab.com/bashrc2/epicyon
Cloning the inbox thread
parent
2f85939c1d
commit
ad5fb99ea7
2
inbox.py
2
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...')
|
||||
|
||||
|
|
10
threads.py
10
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)
|
||||
|
|
Loading…
Reference in New Issue