increase sync cache to 2 minutes

to give synchrotrons being hammered by repeating initial /syncs to get more
chance to actually complete and avoid a DoS
This commit is contained in:
hera 2018-02-28 00:35:03 +00:00 committed by Richard van der Hoff
parent e21c312e16
commit 0ca2857baa

View file

@ -32,6 +32,7 @@ from six import itervalues, iteritems
logger = logging.getLogger(__name__)
SYNC_RESPONSE_CACHE_MS = 2 * 60 * 1000
SyncConfig = collections.namedtuple("SyncConfig", [
"user",
@ -178,7 +179,9 @@ class SyncHandler(object):
self.presence_handler = hs.get_presence_handler()
self.event_sources = hs.get_event_sources()
self.clock = hs.get_clock()
self.response_cache = ResponseCache(hs, "sync")
self.response_cache = ResponseCache(
hs, "sync", timeout_ms=SYNC_RESPONSE_CACHE_MS,
)
self.state = hs.get_state_handler()
def wait_for_sync_for_user(self, sync_config, since_token=None, timeout=0,