forked from indymedia/epicyon
Avoid errors when loading inbox queue items
parent
4dbf07031a
commit
47aa3fbc1e
|
@ -360,6 +360,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
"""
|
||||
# Check if the queue is full
|
||||
if len(self.server.inboxQueue)>=self.server.maxQueueLength:
|
||||
print('Inbox queue is full')
|
||||
return 1
|
||||
|
||||
domainFull=self.server.domain
|
||||
|
|
14
inbox.py
14
inbox.py
|
@ -1011,13 +1011,17 @@ def runInboxQueue(baseDir: str,httpPrefix: str,sendThreads: [],postLog: [], \
|
|||
queueFilename=queue[0]
|
||||
if not os.path.isfile(queueFilename):
|
||||
if debug:
|
||||
print("DEBUG: queue item rejected becase it has no file: "+queueFilename)
|
||||
print("DEBUG: queue item rejected because it has no file: "+queueFilename)
|
||||
queue.pop(0)
|
||||
continue
|
||||
|
||||
# Load the queue json
|
||||
with open(queueFilename, 'r') as fp:
|
||||
queueJson=commentjson.load(fp)
|
||||
try:
|
||||
with open(queueFilename, 'r') as fp:
|
||||
queueJson=commentjson.load(fp)
|
||||
except:
|
||||
print('WARN: Failed to load inbox queue item '+queueFilename)
|
||||
continue
|
||||
|
||||
# clear the daily quotas for maximum numbers of received posts
|
||||
if currTime-quotasLastUpdate>60*60*24:
|
||||
|
@ -1033,6 +1037,8 @@ def runInboxQueue(baseDir: str,httpPrefix: str,sendThreads: [],postLog: [], \
|
|||
if domainMaxPostsPerDay>0:
|
||||
if quotas['domains'].get(postDomain):
|
||||
if quotas['domains'][postDomain]>domainMaxPostsPerDay:
|
||||
if debug:
|
||||
print('DEBUG: Maximum posts for '+postDomain+' reached')
|
||||
queue.pop(0)
|
||||
continue
|
||||
quotas['domains'][postDomain]+=1
|
||||
|
@ -1043,6 +1049,8 @@ def runInboxQueue(baseDir: str,httpPrefix: str,sendThreads: [],postLog: [], \
|
|||
postHandle=queueJson['postNickname']+'@'+postDomain
|
||||
if quotas['accounts'].get(postHandle):
|
||||
if quotas['accounts'][postHandle]>accountMaxPostsPerDay:
|
||||
if debug:
|
||||
print('DEBUG: Maximum posts for '+postHandle+' reached')
|
||||
queue.pop(0)
|
||||
continue
|
||||
quotas['accounts'][postHandle]+=1
|
||||
|
|
4
posts.py
4
posts.py
|
@ -1090,7 +1090,7 @@ def sendToNamedAddresses(session,baseDir: str, \
|
|||
if not recipients:
|
||||
return
|
||||
if debug:
|
||||
print('Sending individually addressed posts: '+str(recipients))
|
||||
print('DEBUG: Sending individually addressed posts: '+str(recipients))
|
||||
# this is after the message has arrived at the server
|
||||
clientToServer=False
|
||||
for address in recipients:
|
||||
|
@ -1109,7 +1109,7 @@ def sendToNamedAddresses(session,baseDir: str, \
|
|||
if toPort:
|
||||
if toPort!=80 and toPort!=443:
|
||||
toDomainFull=toDomain+':'+str(toPort)
|
||||
print('Post sending s2s: '+nickname+'@'+domainFull+' to '+toNickname+'@'+toDomainFull)
|
||||
print('DEBUG: Post sending s2s: '+nickname+'@'+domainFull+' to '+toNickname+'@'+toDomainFull)
|
||||
cc=[]
|
||||
sendSignedJson(postJsonObject,session,baseDir, \
|
||||
nickname,domain,port, \
|
||||
|
|
Loading…
Reference in New Issue