From 7125a97bbe8ad5b43493cfefe18625a8c27821dd Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Tue, 5 Jan 2021 10:48:22 +0000 Subject: [PATCH] Update json signature enforcement state once per min --- inbox.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/inbox.py b/inbox.py index 23d43231a..8b033c6ab 100644 --- a/inbox.py +++ b/inbox.py @@ -11,6 +11,7 @@ import os import datetime import time from linked_data_sig import verifyJsonSignature +from utils import getConfigParam from utils import hasUsersPath from utils import validPostDate from utils import getFullDomain @@ -2536,19 +2537,24 @@ def runInboxQueue(recentPostsCache: {}, maxRecentPosts: int, continue # clear the daily quotas for maximum numbers of received posts - if currTime-quotasLastUpdateDaily > 60 * 60 * 24: + if currTime - quotasLastUpdateDaily > 60 * 60 * 24: quotasDaily = { 'domains': {}, 'accounts': {} } quotasLastUpdateDaily = currTime - # clear the per minute quotas for maximum numbers of received posts - if currTime-quotasLastUpdatePerMin > 60: + if currTime - quotasLastUpdatePerMin > 60: + # clear the per minute quotas for maximum numbers of received posts quotasPerMin = { 'domains': {}, 'accounts': {} } + # also check if the json signature enforcement has changed + verifyAllSigs = getConfigParam(baseDir, "verifyAllSignatures") + if verifyAllSigs is not None: + verifyAllSignatures = verifyAllSigs + # change the last time that this was done quotasLastUpdatePerMin = currTime # limit the number of posts which can arrive per domain per day