From 1b3e381bfccce3a188050955c81ad8cb673eeea7 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 15 Jul 2019 11:25:13 +0100 Subject: [PATCH] Zero values disable quotas --- inbox.py | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/inbox.py b/inbox.py index 211838007..d65ae0261 100644 --- a/inbox.py +++ b/inbox.py @@ -876,25 +876,28 @@ def runInboxQueue(baseDir: str,httpPrefix: str,sendThreads: [],postLog: [], \ # limit the number of posts which can arrive per domain per day postDomain=queueJson['postDomain'] if postDomain: - if quotas['domains'].get(postDomain): - if quotas['domains'][postDomain]>domainMaxPostsPerDay: - queue.pop(0) - continue - quotas['domains'][postDomain]+=1 - else: - quotas['domains'][postDomain]=1 + if domainMaxPostsPerDay>0: + if quotas['domains'].get(postDomain): + if quotas['domains'][postDomain]>domainMaxPostsPerDay: + queue.pop(0) + continue + quotas['domains'][postDomain]+=1 + else: + quotas['domains'][postDomain]=1 - postHandle=queueJson['postNickname']+'@'+postDomain - if quotas['accounts'].get(postHandle): - if quotas['accounts'][postHandle]>accountMaxPostsPerDay: - queue.pop(0) - continue - quotas['accounts'][postHandle]+=1 - else: - quotas['accounts'][postHandle]=1 + if accountMaxPostsPerDay>0: + postHandle=queueJson['postNickname']+'@'+postDomain + if quotas['accounts'].get(postHandle): + if quotas['accounts'][postHandle]>accountMaxPostsPerDay: + queue.pop(0) + continue + quotas['accounts'][postHandle]+=1 + else: + quotas['accounts'][postHandle]=1 if debug: - pprint(quotas) + if accountMaxPostsPerDay>0 or domainMaxPostsPerDay>0: + pprint(quotas) # Try a few times to obtain the public key pubKey=None