Minimum per minute quotas

main
Bob Mottram 2020-03-28 11:46:11 +00:00
parent 36267ac5f4
commit 2f46c2b31f
2 changed files with 5 additions and 1 deletions

View File

@ -2138,6 +2138,8 @@ def runInboxQueue(recentPostsCache: {},maxRecentPosts: int, \
if quotasPerMin['domains'].get(postDomain):
domainMaxPostsPerMin=int(domainMaxPostsPerDay/(24*60))
if domainMaxPostsPerMin<10:
domainMaxPostsPerMin=10
if quotasPerMin['domains'][postDomain]>domainMaxPostsPerMin:
print('DEBUG: Quota per min - Maximum posts for '+postDomain+' reached ('+str(domainMaxPostsPerMin)+')')
if len(queue)>0:
@ -2169,6 +2171,8 @@ def runInboxQueue(recentPostsCache: {},maxRecentPosts: int, \
if quotasPerMin['accounts'].get(postHandle):
accountMaxPostsPerMin=int(accountMaxPostsPerDay/(24*60))
if accountMaxPostsPerMin<10:
accountMaxPostsPerMin=10
if quotasPerMin['accounts'][postHandle]>accountMaxPostsPerMin:
print('DEBUG: Quota account posts per min - Maximum posts for '+postHandle+' reached ('+str(accountMaxPostsPerMin)+')')
if len(queue)>0:

View File

@ -577,7 +577,7 @@ def testPostMessageBetweenServers():
outboxAfterAnnounceCount=len([name for name in os.listdir(outboxPath) if os.path.isfile(os.path.join(outboxPath, name))])
print('inbox items after announce: '+str(afterAnnounceCount))
print('outbox items after announce: '+str(outboxAfterAnnounceCount))
#assert afterAnnounceCount==beforeAnnounceCount+1
assert afterAnnounceCount==beforeAnnounceCount+1
assert outboxAfterAnnounceCount==outboxBeforeAnnounceCount+1
# stop the servers
thrAlice.kill()