summary refs log tree commit diff
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2021-09-13 15:01:15 +0100
committerErik Johnston <erik@matrix.org>2021-09-13 15:01:15 +0100
commit414c5683b9674673aa3b855ac0f0f74d9b3c2e7b (patch)
tree88dff3101744890dcca0ccf07dae62c07205b064
parentMerge remote-tracking branch 'origin/develop' into erikj/join_logging (diff)
downloadsynapse-414c5683b9674673aa3b855ac0f0f74d9b3c2e7b.tar.xz
Don't store event edges for outliers
-rw-r--r--synapse/storage/databases/main/events.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/synapse/storage/databases/main/events.py b/synapse/storage/databases/main/events.py
index da4f2eab33..2c5b9e3c3c 100644
--- a/synapse/storage/databases/main/events.py
+++ b/synapse/storage/databases/main/events.py
@@ -16,7 +16,6 @@
 import itertools
 import logging
 from collections import OrderedDict, namedtuple
-from synapse.logging.opentracing import start_active_span
 from typing import (
     TYPE_CHECKING,
     Any,
@@ -38,6 +37,7 @@ from synapse.api.room_versions import RoomVersions
 from synapse.crypto.event_signing import compute_event_reference_hash
 from synapse.events import EventBase  # noqa: F401
 from synapse.events.snapshot import EventContext  # noqa: F401
+from synapse.logging.opentracing import start_active_span
 from synapse.logging.utils import log_function
 from synapse.storage._base import db_to_json, make_in_list_sql_clause
 from synapse.storage.database import DatabasePool, LoggingTransaction
@@ -1301,6 +1301,8 @@ class PersistEventsStore:
                     },
                 )
 
+                self._handle_mult_prev_events(txn, [event])
+
                 sql = "UPDATE events SET outlier = ? WHERE event_id = ?"
                 txn.execute(sql, (False, event.event_id))
 
@@ -2123,7 +2125,7 @@ class PersistEventsStore:
             values={"min_depth": depth},
         )
 
-    def _handle_mult_prev_events(self, txn, events):
+    def _handle_mult_prev_events(self, txn, events: Iterable[EventBase]):
         """
         For the given event, update the event edges table and forward and
         backward extremities tables.
@@ -2140,6 +2142,7 @@ class PersistEventsStore:
                 }
                 for ev in events
                 for e_id in ev.prev_event_ids()
+                if not ev.internal_metadata.is_outlier()
             ],
         )