mirror of https://gitlab.com/bashrc2/epicyon
Snake case
parent
d37973d092
commit
d21efe800d
12
daemon.py
12
daemon.py
|
@ -1473,14 +1473,14 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
return 3
|
return 3
|
||||||
|
|
||||||
# if the inbox queue is full then return a busy code
|
# if the inbox queue is full then return a busy code
|
||||||
if len(self.server.inboxQueue) >= self.server.max_queue_length:
|
if len(self.server.inbox_queue) >= self.server.max_queue_length:
|
||||||
if messageDomain:
|
if messageDomain:
|
||||||
print('Queue: Inbox queue is full. Incoming post from ' +
|
print('Queue: Inbox queue is full. Incoming post from ' +
|
||||||
messageJson['actor'])
|
messageJson['actor'])
|
||||||
else:
|
else:
|
||||||
print('Queue: Inbox queue is full')
|
print('Queue: Inbox queue is full')
|
||||||
self._503()
|
self._503()
|
||||||
clearQueueItems(self.server.base_dir, self.server.inboxQueue)
|
clearQueueItems(self.server.base_dir, self.server.inbox_queue)
|
||||||
if not self.server.restartInboxQueueInProgress:
|
if not self.server.restartInboxQueueInProgress:
|
||||||
self.server.restartInboxQueue = True
|
self.server.restartInboxQueue = True
|
||||||
self.server.POSTbusy = False
|
self.server.POSTbusy = False
|
||||||
|
@ -1545,8 +1545,8 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self.server.system_language)
|
self.server.system_language)
|
||||||
if queueFilename:
|
if queueFilename:
|
||||||
# add json to the queue
|
# add json to the queue
|
||||||
if queueFilename not in self.server.inboxQueue:
|
if queueFilename not in self.server.inbox_queue:
|
||||||
self.server.inboxQueue.append(queueFilename)
|
self.server.inbox_queue.append(queueFilename)
|
||||||
if self.server.debug:
|
if self.server.debug:
|
||||||
timeDiff = int((time.time() - beginSaveTime) * 1000)
|
timeDiff = int((time.time() - beginSaveTime) * 1000)
|
||||||
if timeDiff > 200:
|
if timeDiff > 200:
|
||||||
|
@ -18750,7 +18750,7 @@ def runDaemon(content_license_url: str,
|
||||||
httpd.GETbusy = False
|
httpd.GETbusy = False
|
||||||
httpd.POSTbusy = False
|
httpd.POSTbusy = False
|
||||||
httpd.received_message = False
|
httpd.received_message = False
|
||||||
httpd.inboxQueue = []
|
httpd.inbox_queue = []
|
||||||
httpd.send_threads = send_threads
|
httpd.send_threads = send_threads
|
||||||
httpd.postLog = []
|
httpd.postLog = []
|
||||||
httpd.max_queue_length = 64
|
httpd.max_queue_length = 64
|
||||||
|
@ -18925,7 +18925,7 @@ def runDaemon(content_license_url: str,
|
||||||
project_version,
|
project_version,
|
||||||
base_dir, http_prefix, httpd.send_threads,
|
base_dir, http_prefix, httpd.send_threads,
|
||||||
httpd.postLog, httpd.cached_webfingers,
|
httpd.postLog, httpd.cached_webfingers,
|
||||||
httpd.person_cache, httpd.inboxQueue,
|
httpd.person_cache, httpd.inbox_queue,
|
||||||
domain, onion_domain, i2p_domain,
|
domain, onion_domain, i2p_domain,
|
||||||
port, proxy_type,
|
port, proxy_type,
|
||||||
httpd.federationList,
|
httpd.federationList,
|
||||||
|
|
10
inbox.py
10
inbox.py
|
@ -549,12 +549,12 @@ def savePostToInboxQueue(base_dir: str, http_prefix: str,
|
||||||
|
|
||||||
# NOTE: don't change post_json_object['id'] before signature check
|
# NOTE: don't change post_json_object['id'] before signature check
|
||||||
|
|
||||||
inboxQueueDir = createInboxQueueDir(nickname, domain, base_dir)
|
inbox_queueDir = createInboxQueueDir(nickname, domain, base_dir)
|
||||||
|
|
||||||
handle = nickname + '@' + domain
|
handle = nickname + '@' + domain
|
||||||
destination = base_dir + '/accounts/' + \
|
destination = base_dir + '/accounts/' + \
|
||||||
handle + '/inbox/' + postId.replace('/', '#') + '.json'
|
handle + '/inbox/' + postId.replace('/', '#') + '.json'
|
||||||
filename = inboxQueueDir + '/' + postId.replace('/', '#') + '.json'
|
filename = inbox_queueDir + '/' + postId.replace('/', '#') + '.json'
|
||||||
|
|
||||||
sharedInboxItem = False
|
sharedInboxItem = False
|
||||||
if nickname == 'inbox':
|
if nickname == 'inbox':
|
||||||
|
@ -3668,15 +3668,15 @@ def runInboxQueueWatchdog(project_version: 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(runInboxQueue)
|
inbox_queueOriginal = httpd.thrInboxQueue.clone(runInboxQueue)
|
||||||
httpd.thrInboxQueue.start()
|
httpd.thrInboxQueue.start()
|
||||||
while True:
|
while True:
|
||||||
time.sleep(20)
|
time.sleep(20)
|
||||||
if not httpd.thrInboxQueue.is_alive() or httpd.restartInboxQueue:
|
if not httpd.thrInboxQueue.is_alive() or httpd.restartInboxQueue:
|
||||||
httpd.restartInboxQueueInProgress = True
|
httpd.restartInboxQueueInProgress = True
|
||||||
httpd.thrInboxQueue.kill()
|
httpd.thrInboxQueue.kill()
|
||||||
httpd.thrInboxQueue = inboxQueueOriginal.clone(runInboxQueue)
|
httpd.thrInboxQueue = inbox_queueOriginal.clone(runInboxQueue)
|
||||||
httpd.inboxQueue.clear()
|
httpd.inbox_queue.clear()
|
||||||
httpd.thrInboxQueue.start()
|
httpd.thrInboxQueue.start()
|
||||||
print('Restarting inbox queue...')
|
print('Restarting inbox queue...')
|
||||||
httpd.restartInboxQueueInProgress = False
|
httpd.restartInboxQueueInProgress = False
|
||||||
|
|
Loading…
Reference in New Issue