diff options
author | Richard van der Hoff <1389908+richvdh@users.noreply.github.com> | 2021-08-03 14:45:04 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-03 14:45:04 +0100 |
commit | 4b10880da363efed5d066191190237f1c64fddfd (patch) | |
tree | 4218a9f817ec47f000d31fad5c30ba7145e27d0e /synapse/handlers | |
parent | Include room ID in ignored EDU log messages (#10507) (diff) | |
download | synapse-4b10880da363efed5d066191190237f1c64fddfd.tar.xz |
Make sync response cache time configurable. (#10513)
Diffstat (limited to '')
-rw-r--r-- | synapse/handlers/sync.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/synapse/handlers/sync.py b/synapse/handlers/sync.py index f30bfcc93c..590642f510 100644 --- a/synapse/handlers/sync.py +++ b/synapse/handlers/sync.py @@ -269,14 +269,22 @@ class SyncHandler: self.presence_handler = hs.get_presence_handler() self.event_sources = hs.get_event_sources() self.clock = hs.get_clock() - self.response_cache: ResponseCache[SyncRequestKey] = ResponseCache( - hs.get_clock(), "sync" - ) self.state = hs.get_state_handler() self.auth = hs.get_auth() self.storage = hs.get_storage() self.state_store = self.storage.state + # TODO: flush cache entries on subsequent sync request. + # Once we get the next /sync request (ie, one with the same access token + # that sets 'since' to 'next_batch'), we know that device won't need a + # cached result any more, and we could flush the entry from the cache to save + # memory. + self.response_cache: ResponseCache[SyncRequestKey] = ResponseCache( + hs.get_clock(), + "sync", + timeout_ms=hs.config.caches.sync_response_cache_duration, + ) + # ExpiringCache((User, Device)) -> LruCache(user_id => event_id) self.lazy_loaded_members_cache: ExpiringCache[ Tuple[str, Optional[str]], LruCache[str, str] |