summary refs log tree commit diff
path: root/synapse/state
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2018-08-09 14:44:10 +0100
committerErik Johnston <erik@matrix.org>2018-08-09 14:58:49 +0100
commitbb99b1f5507e009bc32a82ba6ef29ba2d91e6b65 (patch)
tree41197ba70414b621b96b025d839849b78ff489fb /synapse/state
parentChoose state algorithm based on room version (diff)
downloadsynapse-bb99b1f5507e009bc32a82ba6ef29ba2d91e6b65.tar.xz
Add fast path in state res for zero prev events
Diffstat (limited to 'synapse/state')
-rw-r--r--synapse/state/__init__.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/synapse/state/__init__.py b/synapse/state/__init__.py
index 222daa0b28..f1c26d1071 100644
--- a/synapse/state/__init__.py
+++ b/synapse/state/__init__.py
@@ -361,7 +361,12 @@ class StateHandler(object):
             room_id, event_ids
         )
 
-        if len(state_groups_ids) == 1:
+        if len(state_groups_ids) == 0:
+            defer.returnValue(_StateCacheEntry(
+                state={},
+                state_group=None,
+            ))
+        elif len(state_groups_ids) == 1:
             name, state_list = list(state_groups_ids.items()).pop()
 
             prev_group, delta_ids = yield self.store.get_state_group_delta(name)