master
Bob Mottram 2019-09-03 10:44:50 +01:00
parent d89de123f1
commit d95093810e
1 changed files with 7 additions and 3 deletions

View File

@ -425,10 +425,9 @@ class PubServer(BaseHTTPRequestHandler):
self.server.projectVersion) self.server.projectVersion)
return True return True
def _updateInboxQueue(self,nickname: str,messageJson: {},messageBytes: str) -> int: def _inboxQueueCleardown(self):
"""Update the inbox queue """ Check if the queue is full and remove oldest items if it is
""" """
# Check if the queue is full
if len(self.server.inboxQueue)>=self.server.maxQueueLength: if len(self.server.inboxQueue)>=self.server.maxQueueLength:
print('Inbox queue is full. Removing oldest items.') print('Inbox queue is full. Removing oldest items.')
while len(self.server.inboxQueue) >= self.server.maxQueueLength-4: while len(self.server.inboxQueue) >= self.server.maxQueueLength-4:
@ -437,6 +436,11 @@ class PubServer(BaseHTTPRequestHandler):
os.remove(queueFilename) os.remove(queueFilename)
self.server.inboxQueue.pop(0) self.server.inboxQueue.pop(0)
def _updateInboxQueue(self,nickname: str,messageJson: {},messageBytes: str) -> int:
"""Update the inbox queue
"""
self._inboxQueueCleardown()
# Convert the headers needed for signature verification to dict # Convert the headers needed for signature verification to dict
headersDict={} headersDict={}
headersDict['host']=self.headers['host'] headersDict['host']=self.headers['host']