summary refs log tree commit diff
path: root/synapse/storage/controllers/state.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2022-06-06 18:46:11 +0300
committerGitHub <noreply@github.com>2022-06-06 16:46:11 +0100
commit44de53bb79f961147386ea2a8bfbeb54b007cd41 (patch)
tree69b9b7896e2f69518bebcdd579619099888be9b4 /synapse/storage/controllers/state.py
parentDo not break URL previews if an image is unreachable. (#12950) (diff)
downloadsynapse-44de53bb79f961147386ea2a8bfbeb54b007cd41.tar.xz
Reduce state pulled from DB due to sending typing and receipts over federation (#12964)
Reducing the amount of state we pull from the DB is useful as fetching state is expensive in terms of DB, CPU and memory.
Diffstat (limited to 'synapse/storage/controllers/state.py')
-rw-r--r--synapse/storage/controllers/state.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/synapse/storage/controllers/state.py b/synapse/storage/controllers/state.py
index 63a78ebc87..3b4cdb67eb 100644
--- a/synapse/storage/controllers/state.py
+++ b/synapse/storage/controllers/state.py
@@ -23,6 +23,7 @@ from typing import (
     List,
     Mapping,
     Optional,
+    Set,
     Tuple,
 )
 
@@ -482,3 +483,10 @@ class StateStorageController:
             room_id, StateFilter.from_types((key,))
         )
         return state_map.get(key)
+
+    async def get_current_hosts_in_room(self, room_id: str) -> Set[str]:
+        """Get current hosts in room based on current state."""
+
+        await self._partial_state_room_tracker.await_full_state(room_id)
+
+        return await self.stores.main.get_current_hosts_in_room(room_id)