diff options
author | Erik Johnston <erik@matrix.org> | 2019-12-09 13:42:49 +0000 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2019-12-09 13:42:49 +0000 |
commit | f166a8d1f52f1fda1a64d8cd50f17275d63c8843 (patch) | |
tree | 79062c260ede6ca80c5b58be074475174f08410f /synapse/handlers | |
parent | Merge pull request #6493 from matrix-org/erikj/invite_state_config (diff) | |
download | synapse-f166a8d1f52f1fda1a64d8cd50f17275d63c8843.tar.xz |
Remove SnapshotCache in favour of ResponseCache
Diffstat (limited to 'synapse/handlers')
-rw-r--r-- | synapse/handlers/initial_sync.py | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/synapse/handlers/initial_sync.py b/synapse/handlers/initial_sync.py index 81dce96f4b..73c110a92b 100644 --- a/synapse/handlers/initial_sync.py +++ b/synapse/handlers/initial_sync.py @@ -26,7 +26,7 @@ from synapse.streams.config import PaginationConfig from synapse.types import StreamToken, UserID from synapse.util import unwrapFirstError from synapse.util.async_helpers import concurrently_execute -from synapse.util.caches.snapshot_cache import SnapshotCache +from synapse.util.caches.response_cache import ResponseCache from synapse.visibility import filter_events_for_client from ._base import BaseHandler @@ -41,7 +41,7 @@ class InitialSyncHandler(BaseHandler): self.state = hs.get_state_handler() self.clock = hs.get_clock() self.validator = EventValidator() - self.snapshot_cache = SnapshotCache() + self.snapshot_cache = ResponseCache(hs, "initial_sync_cache") self._event_serializer = hs.get_event_client_serializer() self.storage = hs.get_storage() self.state_store = self.storage.state @@ -79,17 +79,14 @@ class InitialSyncHandler(BaseHandler): as_client_event, include_archived, ) - now_ms = self.clock.time_msec() - result = self.snapshot_cache.get(now_ms, key) - if result is not None: - return result - return self.snapshot_cache.set( - now_ms, + return self.snapshot_cache.wrap( key, - self._snapshot_all_rooms( - user_id, pagin_config, as_client_event, include_archived - ), + self._snapshot_all_rooms, + user_id, + pagin_config, + as_client_event, + include_archived, ) @defer.inlineCallbacks |