Remove oldest items from inbox queue if it is full

master
Bob Mottram 2019-08-31 20:58:15 +01:00
parent b1e6df06a2
commit 323e806adb
1 changed files with 3 additions and 2 deletions

View File

@ -429,8 +429,9 @@ class PubServer(BaseHTTPRequestHandler):
"""
# Check if the queue is full
if len(self.server.inboxQueue)>=self.server.maxQueueLength:
print('Inbox queue is full')
return 1
print('Inbox queue is full. Removing oldest items.')
while len(self.server.inboxQueue) >= self.server.maxQueueLength-2:
self.server.inboxQueue.pop(0)
# Convert the headers needed for signature verification to dict
headersDict={}