summary refs log tree commit diff
path: root/synapse/handlers/sync.py
diff options
context:
space:
mode:
authorhera <matrix@template.upcloud.com>2018-02-28 00:35:03 +0000
committerRichard van der Hoff <richard@matrix.org>2018-06-22 15:58:15 +0100
commit0ca2857baab2d241a740a6ba5e8ed36d17756338 (patch)
tree7c737237621409e939b7dffcd6682825b7267a78 /synapse/handlers/sync.py
parentActuall set cache factors in workers (diff)
downloadsynapse-0ca2857baab2d241a740a6ba5e8ed36d17756338.tar.xz
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
Diffstat (limited to 'synapse/handlers/sync.py')
-rw-r--r--synapse/handlers/sync.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/synapse/handlers/sync.py b/synapse/handlers/sync.py

index 1e8a50514b..8df66b0fcf 100644 --- a/synapse/handlers/sync.py +++ b/synapse/handlers/sync.py
@@ -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,