mirror of https://gitlab.com/bashrc2/epicyon
Add a watchdog for the inbox thread
parent
9bdb0c007a
commit
5ca2b1c762
|
@ -47,6 +47,7 @@ from posts import expireCache
|
||||||
from inbox import inboxPermittedMessage
|
from inbox import inboxPermittedMessage
|
||||||
from inbox import inboxMessageHasParams
|
from inbox import inboxMessageHasParams
|
||||||
from inbox import runInboxQueue
|
from inbox import runInboxQueue
|
||||||
|
from inbox import runInboxQueueWatchdog
|
||||||
from inbox import savePostToInboxQueue
|
from inbox import savePostToInboxQueue
|
||||||
from inbox import populateReplies
|
from inbox import populateReplies
|
||||||
from follow import getFollowingFeed
|
from follow import getFollowingFeed
|
||||||
|
@ -3377,7 +3378,10 @@ def runDaemon(projectVersion, \
|
||||||
httpd.ocapAlways,maxReplies, \
|
httpd.ocapAlways,maxReplies, \
|
||||||
domainMaxPostsPerDay,accountMaxPostsPerDay, \
|
domainMaxPostsPerDay,accountMaxPostsPerDay, \
|
||||||
allowDeletion,debug,httpd.acceptedCaps),daemon=True)
|
allowDeletion,debug,httpd.acceptedCaps),daemon=True)
|
||||||
httpd.thrInboxQueue.start()
|
httpd.thrWatchdog= \
|
||||||
|
threadWithTrace(target=runInboxQueueWatchdog, \
|
||||||
|
args=(projectVersion,httpd),daemon=True)
|
||||||
|
httpd.thrWatchdog.start()
|
||||||
if clientToServer:
|
if clientToServer:
|
||||||
print('Running ActivityPub client on ' + domain + ' port ' + str(proxyPort))
|
print('Running ActivityPub client on ' + domain + ' port ' + str(proxyPort))
|
||||||
else:
|
else:
|
||||||
|
|
12
inbox.py
12
inbox.py
|
@ -1136,6 +1136,18 @@ def restoreQueueItems(baseDir: str,queue: []) -> None:
|
||||||
if len(queue)>0:
|
if len(queue)>0:
|
||||||
print('Restored '+str(len(queue))+' inbox queue items')
|
print('Restored '+str(len(queue))+' inbox queue items')
|
||||||
|
|
||||||
|
def runInboxQueueWatchdog(projectVersion: str,httpd) -> None:
|
||||||
|
"""This tries to keep the inbox thread running even if it dies
|
||||||
|
"""
|
||||||
|
print('Starting inbox queue watchdog')
|
||||||
|
httpd.thrInboxQueue.start()
|
||||||
|
while True:
|
||||||
|
time.sleep(20)
|
||||||
|
if not httpd.thrInboxQueue.isAlive():
|
||||||
|
httpd.thrInboxQueue.kill()
|
||||||
|
httpd.thrInboxQueue.start()
|
||||||
|
print('Restarting inbox queue...')
|
||||||
|
|
||||||
def runInboxQueue(projectVersion: str, \
|
def runInboxQueue(projectVersion: str, \
|
||||||
baseDir: str,httpPrefix: str,sendThreads: [],postLog: [], \
|
baseDir: str,httpPrefix: str,sendThreads: [],postLog: [], \
|
||||||
cachedWebfingers: {},personCache: {},queue: [], \
|
cachedWebfingers: {},personCache: {},queue: [], \
|
||||||
|
|
Loading…
Reference in New Issue