Zero values disable quotas

master
Bob Mottram 2019-07-15 11:25:13 +01:00
parent ce6a60e66e
commit 1b3e381bfc
1 changed files with 19 additions and 16 deletions

View File

@ -876,25 +876,28 @@ def runInboxQueue(baseDir: str,httpPrefix: str,sendThreads: [],postLog: [], \
# limit the number of posts which can arrive per domain per day # limit the number of posts which can arrive per domain per day
postDomain=queueJson['postDomain'] postDomain=queueJson['postDomain']
if postDomain: if postDomain:
if quotas['domains'].get(postDomain): if domainMaxPostsPerDay>0:
if quotas['domains'][postDomain]>domainMaxPostsPerDay: if quotas['domains'].get(postDomain):
queue.pop(0) if quotas['domains'][postDomain]>domainMaxPostsPerDay:
continue queue.pop(0)
quotas['domains'][postDomain]+=1 continue
else: quotas['domains'][postDomain]+=1
quotas['domains'][postDomain]=1 else:
quotas['domains'][postDomain]=1
postHandle=queueJson['postNickname']+'@'+postDomain if accountMaxPostsPerDay>0:
if quotas['accounts'].get(postHandle): postHandle=queueJson['postNickname']+'@'+postDomain
if quotas['accounts'][postHandle]>accountMaxPostsPerDay: if quotas['accounts'].get(postHandle):
queue.pop(0) if quotas['accounts'][postHandle]>accountMaxPostsPerDay:
continue queue.pop(0)
quotas['accounts'][postHandle]+=1 continue
else: quotas['accounts'][postHandle]+=1
quotas['accounts'][postHandle]=1 else:
quotas['accounts'][postHandle]=1
if debug: if debug:
pprint(quotas) if accountMaxPostsPerDay>0 or domainMaxPostsPerDay>0:
pprint(quotas)
# Try a few times to obtain the public key # Try a few times to obtain the public key
pubKey=None pubKey=None