Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
increase sync cache to 2 minutes
Browse files Browse the repository at this point in the history
to give synchrotrons being hammered by repeating initial /syncs to get more
chance to actually complete and avoid a DoS
  • Loading branch information
hera authored and richvdh committed Jun 22, 2018
1 parent e21c312 commit 0ca2857
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion synapse/handlers/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

logger = logging.getLogger(__name__)

SYNC_RESPONSE_CACHE_MS = 2 * 60 * 1000

SyncConfig = collections.namedtuple("SyncConfig", [
"user",
Expand Down Expand Up @@ -178,7 +179,9 @@ def __init__(self, hs):
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,
Expand Down

0 comments on commit 0ca2857

Please sign in to comment.