Account quotas per day

main
Bob Mottram 2020-03-25 10:47:13 +00:00
parent 05ef1933b4
commit 9333bf012b
1 changed files with 14 additions and 4 deletions

View File

@ -2124,7 +2124,7 @@ def runInboxQueue(recentPostsCache: {},maxRecentPosts: int, \
if domainMaxPostsPerDay>0:
if quotasDaily['domains'].get(postDomain):
if quotasDaily['domains'][postDomain]>domainMaxPostsPerDay:
print('DEBUG: Quota per day - Maximum posts for '+postDomain+' reached')
print('DEBUG: Quota per day - Maximum posts for '+postDomain+' reached ('+str(domainMaxPostsPerDay)+')')
if len(queue)>0:
queue.pop(0)
continue
@ -2135,7 +2135,7 @@ def runInboxQueue(recentPostsCache: {},maxRecentPosts: int, \
if quotasPerMin['domains'].get(postDomain):
domainMaxPostsPerMin=int(domainMaxPostsPerDay/(24*60))
if quotasPerMin['domains'][postDomain]>domainMaxPostsPerMin:
print('DEBUG: Quota per min - Maximum posts for '+postDomain+' reached')
print('DEBUG: Quota per min - Maximum posts for '+postDomain+' reached ('+str(domainMaxPostsPerMin)+')')
if len(queue)>0:
queue.pop(0)
continue
@ -2147,8 +2147,7 @@ def runInboxQueue(recentPostsCache: {},maxRecentPosts: int, \
postHandle=queueJson['postNickname']+'@'+postDomain
if quotasDaily['accounts'].get(postHandle):
if quotasDaily['accounts'][postHandle]>accountMaxPostsPerDay:
if debug:
print('DEBUG: Maximum posts for '+postHandle+' reached')
print('DEBUG: Quota account posts per day - Maximum posts for '+postHandle+' reached ('+str(accountMaxPostsPerDay)+')')
if len(queue)>0:
queue.pop(0)
continue
@ -2156,6 +2155,17 @@ def runInboxQueue(recentPostsCache: {},maxRecentPosts: int, \
else:
quotasDaily['accounts'][postHandle]=1
if quotasPerMin['accounts'].get(postHandle):
accountMaxPostsPerMin=int(accountMaxPostsPerDay/(24*60))
if quotasPerMin['accounts'][postHandle]>accountMaxPostsPerMin:
print('DEBUG: Quota account posts per min - Maximum posts for '+postHandle+' reached ('+str(accountMaxPostsPerMin)+')')
if len(queue)>0:
queue.pop(0)
continue
quotasPerMin['accounts'][postHandle]+=1
else:
quotasPerMin['accounts'][postHandle]=1
if debug:
if accountMaxPostsPerDay>0 or domainMaxPostsPerDay>0:
pprint(quotasDaily)