diff options
author | Erik Johnston <erikj@element.io> | 2024-01-10 15:11:59 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-10 15:11:59 +0000 |
commit | cbe8a80d108068c585f76bc18e14c61371644f84 (patch) | |
tree | 797e5aae7360e76d2fd81fc65ff35d44abbbdf7c /synapse/handlers/sync.py | |
parent | Bump types-commonmark from 0.9.2.4 to 0.9.2.20240106 (#16797) (diff) | |
download | synapse-cbe8a80d108068c585f76bc18e14c61371644f84.tar.xz |
Faster load recents for sync (#16783)
This hopefully reduces the amount of state we need to keep in memory
Diffstat (limited to 'synapse/handlers/sync.py')
-rw-r--r-- | synapse/handlers/sync.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/synapse/handlers/sync.py b/synapse/handlers/sync.py index 0385c04bc2..2e10035772 100644 --- a/synapse/handlers/sync.py +++ b/synapse/handlers/sync.py @@ -583,10 +583,11 @@ class SyncHandler: # `recents`, so partial state is only a problem when a membership # event turns up in `recents` but has not made it into the current # state. - current_state_ids_map = ( - await self.store.get_partial_current_state_ids(room_id) + current_state_ids = ( + await self.store.check_if_events_in_current_state( + {e.event_id for e in recents if e.is_state()} + ) ) - current_state_ids = frozenset(current_state_ids_map.values()) recents = await filter_events_for_client( self._storage_controllers, @@ -667,10 +668,11 @@ class SyncHandler: # `loaded_recents`, so partial state is only a problem when a # membership event turns up in `loaded_recents` but has not made it # into the current state. - current_state_ids_map = ( - await self.store.get_partial_current_state_ids(room_id) + current_state_ids = ( + await self.store.check_if_events_in_current_state( + {e.event_id for e in loaded_recents if e.is_state()} + ) ) - current_state_ids = frozenset(current_state_ids_map.values()) loaded_recents = await filter_events_for_client( self._storage_controllers, |