summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--synapse/storage/event_federation.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/synapse/storage/event_federation.py b/synapse/storage/event_federation.py
index 26d570cf2d..91d19857b1 100644
--- a/synapse/storage/event_federation.py
+++ b/synapse/storage/event_federation.py
@@ -394,8 +394,16 @@ class EventFederationStore(SQLBaseStore):
                 (room_id, event_id, limit - len(event_results))
             )
 
-            for row in txn.fetchall():
-                queue.put((-row[0], row[1]))
+            depth = self._simple_select_one_onecol_txn(
+                txn,
+                table="events",
+                keyvalues={
+                    "event_id": event_id,
+                },
+                retcol="depth"
+            )
+
+            queue.put((-depth, event_id))
 
         while not queue.empty() and len(event_results) < limit:
             try: