summary refs log tree commit diff
path: root/synapse/state.py
diff options
context:
space:
mode:
authorErik Johnston <erikj@jki.re>2017-05-05 10:15:24 +0100
committerGitHub <noreply@github.com>2017-05-05 10:15:24 +0100
commit8af45695830e4e16cd26c9aadc7a6f92e9ab7c55 (patch)
tree862131a9e66e3419b5c7d1c5e7bc40f9222558c1 /synapse/state.py
parentMerge pull request #2186 from matrix-org/revert-2175-erikj/prefill_state (diff)
parentIntern host strings (diff)
downloadsynapse-8af45695830e4e16cd26c9aadc7a6f92e9ab7c55.tar.xz
Merge pull request #2174 from matrix-org/erikj/current_cache_hosts
Add cache for get_current_hosts_in_room
Diffstat (limited to 'synapse/state.py')
-rw-r--r--synapse/state.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/synapse/state.py b/synapse/state.py
index f6b83d888a..02fee47f39 100644
--- a/synapse/state.py
+++ b/synapse/state.py
@@ -176,6 +176,17 @@ class StateHandler(object):
         defer.returnValue(joined_users)
 
     @defer.inlineCallbacks
+    def get_current_hosts_in_room(self, room_id, latest_event_ids=None):
+        if not latest_event_ids:
+            latest_event_ids = yield self.store.get_latest_event_ids_in_room(room_id)
+        logger.debug("calling resolve_state_groups from get_current_hosts_in_room")
+        entry = yield self.resolve_state_groups(room_id, latest_event_ids)
+        joined_hosts = yield self.store.get_joined_hosts(
+            room_id, entry.state_id, entry.state
+        )
+        defer.returnValue(joined_hosts)
+
+    @defer.inlineCallbacks
     def compute_event_context(self, event, old_state=None):
         """Build an EventContext structure for the event.