forked from indymedia/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
|
"""This tries to keep the inbox thread running even if it dies
|
||||||
"""
|
"""
|
||||||
print('Starting inbox queue watchdog')
|
print('Starting inbox queue watchdog')
|
||||||
|
inboxQueueOriginal=httpd.thrInboxQueue.clone()
|
||||||
httpd.thrInboxQueue.start()
|
httpd.thrInboxQueue.start()
|
||||||
while True:
|
while True:
|
||||||
time.sleep(20)
|
time.sleep(20)
|
||||||
if not httpd.thrInboxQueue.isAlive():
|
if not httpd.thrInboxQueue.isAlive():
|
||||||
httpd.thrInboxQueue.kill()
|
httpd.thrInboxQueue.kill()
|
||||||
|
httpd.thrInboxQueue=inboxQueueOriginal.clone()
|
||||||
httpd.thrInboxQueue.start()
|
httpd.thrInboxQueue.start()
|
||||||
print('Restarting inbox queue...')
|
print('Restarting inbox queue...')
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,8 @@ import time
|
||||||
|
|
||||||
class threadWithTrace(threading.Thread):
|
class threadWithTrace(threading.Thread):
|
||||||
def __init__(self, *args, **keywords):
|
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
|
self.killed = False
|
||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
|
@ -40,3 +41,8 @@ class threadWithTrace(threading.Thread):
|
||||||
|
|
||||||
def kill(self):
|
def kill(self):
|
||||||
self.killed = True
|
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