summary refs log tree commit diff
path: root/synapse/state.py
diff options
context:
space:
mode:
authorMatthew Hodgson <matthew@matrix.org>2016-04-07 17:26:44 +0100
committerMatthew Hodgson <matthew@matrix.org>2016-04-07 17:26:44 +0100
commitd6e7333ae47feb1c31753dd2eebd09e42907218b (patch)
tree250363cd2d3460c01fb2ab1ad3652d5530446f82 /synapse/state.py
parentMerge branch 'develop' into matthew/preview_urls (diff)
parentMerge pull request #704 from matrix-org/markh/slaveIII (diff)
downloadsynapse-d6e7333ae47feb1c31753dd2eebd09e42907218b.tar.xz
Merge branch 'develop' into matthew/preview_urls
Diffstat (limited to 'synapse/state.py')
-rw-r--r--synapse/state.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/synapse/state.py b/synapse/state.py
index 1bca0f8f78..58211f5feb 100644
--- a/synapse/state.py
+++ b/synapse/state.py
@@ -75,7 +75,8 @@ class StateHandler(object):
         self._state_cache.start()
 
     @defer.inlineCallbacks
-    def get_current_state(self, room_id, event_type=None, state_key=""):
+    def get_current_state(self, room_id, event_type=None, state_key="",
+                          latest_event_ids=None):
         """ Retrieves the current state for the room. This is done by
         calling `get_latest_events_in_room` to get the leading edges of the
         event graph and then resolving any of the state conflicts.
@@ -89,9 +90,10 @@ class StateHandler(object):
         Returns:
             map from (type, state_key) to event
         """
-        event_ids = yield self.store.get_latest_event_ids_in_room(room_id)
+        if not latest_event_ids:
+            latest_event_ids = yield self.store.get_latest_event_ids_in_room(room_id)
 
-        res = yield self.resolve_state_groups(room_id, event_ids)
+        res = yield self.resolve_state_groups(room_id, latest_event_ids)
         state = res[1]
 
         if event_type: