forked from indymedia/epicyon
Account quotas per day
parent
05ef1933b4
commit
9333bf012b
18
inbox.py
18
inbox.py
|
@ -2124,7 +2124,7 @@ def runInboxQueue(recentPostsCache: {},maxRecentPosts: int, \
|
||||||
if domainMaxPostsPerDay>0:
|
if domainMaxPostsPerDay>0:
|
||||||
if quotasDaily['domains'].get(postDomain):
|
if quotasDaily['domains'].get(postDomain):
|
||||||
if quotasDaily['domains'][postDomain]>domainMaxPostsPerDay:
|
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:
|
if len(queue)>0:
|
||||||
queue.pop(0)
|
queue.pop(0)
|
||||||
continue
|
continue
|
||||||
|
@ -2135,7 +2135,7 @@ def runInboxQueue(recentPostsCache: {},maxRecentPosts: int, \
|
||||||
if quotasPerMin['domains'].get(postDomain):
|
if quotasPerMin['domains'].get(postDomain):
|
||||||
domainMaxPostsPerMin=int(domainMaxPostsPerDay/(24*60))
|
domainMaxPostsPerMin=int(domainMaxPostsPerDay/(24*60))
|
||||||
if quotasPerMin['domains'][postDomain]>domainMaxPostsPerMin:
|
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:
|
if len(queue)>0:
|
||||||
queue.pop(0)
|
queue.pop(0)
|
||||||
continue
|
continue
|
||||||
|
@ -2147,8 +2147,7 @@ def runInboxQueue(recentPostsCache: {},maxRecentPosts: int, \
|
||||||
postHandle=queueJson['postNickname']+'@'+postDomain
|
postHandle=queueJson['postNickname']+'@'+postDomain
|
||||||
if quotasDaily['accounts'].get(postHandle):
|
if quotasDaily['accounts'].get(postHandle):
|
||||||
if quotasDaily['accounts'][postHandle]>accountMaxPostsPerDay:
|
if quotasDaily['accounts'][postHandle]>accountMaxPostsPerDay:
|
||||||
if debug:
|
print('DEBUG: Quota account posts per day - Maximum posts for '+postHandle+' reached ('+str(accountMaxPostsPerDay)+')')
|
||||||
print('DEBUG: Maximum posts for '+postHandle+' reached')
|
|
||||||
if len(queue)>0:
|
if len(queue)>0:
|
||||||
queue.pop(0)
|
queue.pop(0)
|
||||||
continue
|
continue
|
||||||
|
@ -2156,6 +2155,17 @@ def runInboxQueue(recentPostsCache: {},maxRecentPosts: int, \
|
||||||
else:
|
else:
|
||||||
quotasDaily['accounts'][postHandle]=1
|
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 debug:
|
||||||
if accountMaxPostsPerDay>0 or domainMaxPostsPerDay>0:
|
if accountMaxPostsPerDay>0 or domainMaxPostsPerDay>0:
|
||||||
pprint(quotasDaily)
|
pprint(quotasDaily)
|
||||||
|
|
Loading…
Reference in New Issue