summary refs log tree commit diff
path: root/synapse/storage/state.py
diff options
context:
space:
mode:
authorMark Haines <mjark@negativecurvature.net>2016-03-30 15:58:49 +0100
committerMark Haines <mjark@negativecurvature.net>2016-03-30 15:58:49 +0100
commitfc66df1e60eed066a9aca1b3db28e121541c77ef (patch)
treeda41bfc59a9371d9a40716789222f7a56f8ee39a /synapse/storage/state.py
parentMerge pull request #673 from matrix-org/erikj/forget (diff)
parentUse a stream id generator to assign state group ids (diff)
downloadsynapse-fc66df1e60eed066a9aca1b3db28e121541c77ef.tar.xz
Merge pull request #674 from matrix-org/markjh/replicate_state
Use a stream id generator to assign state group ids
Diffstat (limited to 'synapse/storage/state.py')
-rw-r--r--synapse/storage/state.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/synapse/storage/state.py b/synapse/storage/state.py
index 02cefdff26..30d1060ecd 100644
--- a/synapse/storage/state.py
+++ b/synapse/storage/state.py
@@ -64,12 +64,12 @@ class StateStore(SQLBaseStore):
             for group, state_map in group_to_state.items()
         })
 
-    def _store_state_groups_txn(self, txn, event, context):
-        return self._store_mult_state_groups_txn(txn, [(event, context)])
-
     def _store_mult_state_groups_txn(self, txn, events_and_contexts):
         state_groups = {}
         for event, context in events_and_contexts:
+            if event.internal_metadata.is_outlier():
+                continue
+
             if context.current_state is None:
                 continue
 
@@ -82,7 +82,8 @@ class StateStore(SQLBaseStore):
             if event.is_state():
                 state_events[(event.type, event.state_key)] = event
 
-            state_group = self._state_groups_id_gen.get_next()
+            state_group = context.new_state_group_id
+
             self._simple_insert_txn(
                 txn,
                 table="state_groups",
@@ -114,11 +115,10 @@ class StateStore(SQLBaseStore):
             table="event_to_state_groups",
             values=[
                 {
-                    "state_group": state_groups[event.event_id],
-                    "event_id": event.event_id,
+                    "state_group": state_group_id,
+                    "event_id": event_id,
                 }
-                for event, context in events_and_contexts
-                if context.current_state is not None
+                for event_id, state_group_id in state_groups.items()
             ],
         )