summary refs log tree commit diff
path: root/synapse/storage/state.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2017-05-17 11:25:23 +0100
committerErik Johnston <erik@matrix.org>2017-05-17 11:25:23 +0100
commitac08316548cf02c5991d455e96915959af603e0e (patch)
tree6d4028791cc5656b90be063abdc2f7b2e73f68f4 /synapse/storage/state.py
parentBump version and changelog (diff)
parentMerge pull request #2228 from matrix-org/erikj/speed_up_get_hosts (diff)
downloadsynapse-ac08316548cf02c5991d455e96915959af603e0e.tar.xz
Merge branch 'develop' of github.com:matrix-org/synapse into release-v0.21.0
Diffstat (limited to 'synapse/storage/state.py')
-rw-r--r--synapse/storage/state.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/synapse/storage/state.py b/synapse/storage/state.py
index a16afa8df5..85acf2ad1e 100644
--- a/synapse/storage/state.py
+++ b/synapse/storage/state.py
@@ -227,6 +227,18 @@ class StateStore(SQLBaseStore):
                     ],
                 )
 
+            # Prefill the state group cache with this group.
+            # It's fine to use the sequence like this as the state group map
+            # is immutable. (If the map wasn't immutable then this prefill could
+            # race with another update)
+            txn.call_after(
+                self._state_group_cache.update,
+                self._state_group_cache.sequence,
+                key=context.state_group,
+                value=dict(context.current_state_ids),
+                full=True,
+            )
+
         self._simple_insert_many_txn(
             txn,
             table="event_to_state_groups",