Remove queue file when over quota

main
Bob Mottram 2020-03-25 10:52:53 +00:00
parent 9333bf012b
commit 305e45ea91
1 changed files with 20 additions and 0 deletions

View File

@ -2126,6 +2126,11 @@ def runInboxQueue(recentPostsCache: {},maxRecentPosts: int, \
if quotasDaily['domains'][postDomain]>domainMaxPostsPerDay: if quotasDaily['domains'][postDomain]>domainMaxPostsPerDay:
print('DEBUG: Quota per day - Maximum posts for '+postDomain+' reached ('+str(domainMaxPostsPerDay)+')') print('DEBUG: Quota per day - Maximum posts for '+postDomain+' reached ('+str(domainMaxPostsPerDay)+')')
if len(queue)>0: if len(queue)>0:
if os.path.isfile(queueFilename):
try:
os.remove(queueFilename)
except:
pass
queue.pop(0) queue.pop(0)
continue continue
quotasDaily['domains'][postDomain]+=1 quotasDaily['domains'][postDomain]+=1
@ -2137,6 +2142,11 @@ def runInboxQueue(recentPostsCache: {},maxRecentPosts: int, \
if quotasPerMin['domains'][postDomain]>domainMaxPostsPerMin: if quotasPerMin['domains'][postDomain]>domainMaxPostsPerMin:
print('DEBUG: Quota per min - Maximum posts for '+postDomain+' reached ('+str(domainMaxPostsPerMin)+')') print('DEBUG: Quota per min - Maximum posts for '+postDomain+' reached ('+str(domainMaxPostsPerMin)+')')
if len(queue)>0: if len(queue)>0:
if os.path.isfile(queueFilename):
try:
os.remove(queueFilename)
except:
pass
queue.pop(0) queue.pop(0)
continue continue
quotasPerMin['domains'][postDomain]+=1 quotasPerMin['domains'][postDomain]+=1
@ -2149,6 +2159,11 @@ def runInboxQueue(recentPostsCache: {},maxRecentPosts: int, \
if quotasDaily['accounts'][postHandle]>accountMaxPostsPerDay: if quotasDaily['accounts'][postHandle]>accountMaxPostsPerDay:
print('DEBUG: Quota account posts per day - Maximum posts for '+postHandle+' reached ('+str(accountMaxPostsPerDay)+')') print('DEBUG: Quota account posts per day - Maximum posts for '+postHandle+' reached ('+str(accountMaxPostsPerDay)+')')
if len(queue)>0: if len(queue)>0:
if os.path.isfile(queueFilename):
try:
os.remove(queueFilename)
except:
pass
queue.pop(0) queue.pop(0)
continue continue
quotasDaily['accounts'][postHandle]+=1 quotasDaily['accounts'][postHandle]+=1
@ -2160,6 +2175,11 @@ def runInboxQueue(recentPostsCache: {},maxRecentPosts: int, \
if quotasPerMin['accounts'][postHandle]>accountMaxPostsPerMin: if quotasPerMin['accounts'][postHandle]>accountMaxPostsPerMin:
print('DEBUG: Quota account posts per min - Maximum posts for '+postHandle+' reached ('+str(accountMaxPostsPerMin)+')') print('DEBUG: Quota account posts per min - Maximum posts for '+postHandle+' reached ('+str(accountMaxPostsPerMin)+')')
if len(queue)>0: if len(queue)>0:
if os.path.isfile(queueFilename):
try:
os.remove(queueFilename)
except:
pass
queue.pop(0) queue.pop(0)
continue continue
quotasPerMin['accounts'][postHandle]+=1 quotasPerMin['accounts'][postHandle]+=1