summary refs log tree commit diff
path: root/synapse/storage/events.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2018-05-30 11:30:33 +0100
committerErik Johnston <erik@matrix.org>2018-05-30 11:30:33 +0100
commit6c1d13a15a49d6a003348f627fff9abb653cd317 (patch)
tree220d6df66b0cf2757fd4c744cf4ef127289b5e5b /synapse/storage/events.py
parentCompute new chunks for new events (diff)
downloadsynapse-6c1d13a15a49d6a003348f627fff9abb653cd317.tar.xz
Correctly loop over events_and_contexts
Diffstat (limited to 'synapse/storage/events.py')
-rw-r--r--synapse/storage/events.py30
1 files changed, 14 insertions, 16 deletions
diff --git a/synapse/storage/events.py b/synapse/storage/events.py
index 6db390485a..77a0dcd3b8 100644
--- a/synapse/storage/events.py
+++ b/synapse/storage/events.py
@@ -1115,19 +1115,19 @@ class EventsStore(EventsWorkerStore):
             ],
         )
 
-        if event.internal_metadata.is_outlier():
-            chunk_id, _topo = None, 0
-        else:
-            chunk_id, _topo = self._compute_chunk_id_txn(
-                txn, event.room_id, event.event_id,
-                [eid for eid, _ in event.prev_events],
-            )
+        for event, _ in events_and_contexts:
+            if event.internal_metadata.is_outlier():
+                chunk_id, _topo = None, 0
+            else:
+                chunk_id, _topo = self._compute_chunk_id_txn(
+                    txn, event.room_id, event.event_id,
+                    [eid for eid, _ in event.prev_events],
+                )
 
-        self._simple_insert_many_txn(
-            txn,
-            table="events",
-            values=[
-                {
+            self._simple_insert_txn(
+                txn,
+                table="events",
+                values={
                     "stream_ordering": event.internal_metadata.stream_ordering,
                     "chunk_id": chunk_id,
                     "topological_ordering": event.depth,
@@ -1145,10 +1145,8 @@ class EventsStore(EventsWorkerStore):
                         "url" in event.content
                         and isinstance(event.content["url"], basestring)
                     ),
-                }
-                for event, _ in events_and_contexts
-            ],
-        )
+                },
+            )
 
     def _store_rejected_events_txn(self, txn, events_and_contexts):
         """Add rows to the 'rejections' table for received events which were