From 685d98b75c12b5852739899cbe21073ff9113f9e Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Wed, 6 Jan 2021 17:46:41 +0000 Subject: [PATCH] Moar fixups --- synapse/storage/databases/main/events_bg_updates.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/synapse/storage/databases/main/events_bg_updates.py b/synapse/storage/databases/main/events_bg_updates.py index 3db46069c171..71abb5ff78c2 100644 --- a/synapse/storage/databases/main/events_bg_updates.py +++ b/synapse/storage/databases/main/events_bg_updates.py @@ -751,7 +751,9 @@ def _get_event_ids(txn: Cursor) -> List[Tuple[str, int, int]]: sql = """ SELECT event_id, topological_ordering, stream_ordering FROM events INNER JOIN state_events USING (event_id) + LEFT JOIN event_auth_chains USING (event_id) WHERE events.room_id = ? AND (topological_ordering, stream_ordering) > (?, ?) + AND event_auth_chains.event_id IS NULL ORDER BY topological_ordering, stream_ordering LIMIT ? """ @@ -767,7 +769,7 @@ def _get_event_ids(txn: Cursor) -> List[Tuple[str, int, int]]: event_ids, redact_behaviour=EventRedactBehaviour.AS_IS, allow_rejected=True ) - await self.runInteraction( + await self.db_pool.runInteraction( "_chain_cover_index_info", self.hs.get_datastores().persist_events._add_chain_info, events,