summary refs log tree commit diff
path: root/synapse/storage/event_federation.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2016-04-01 17:39:32 +0100
committerErik Johnston <erik@matrix.org>2016-04-01 17:39:32 +0100
commitd76d89323c4b962b4f3ff72a3c9b40f2d2d347b3 (patch)
tree3bdcc5d9ce89feae3f9545d5f02cc54584eb8d2c /synapse/storage/event_federation.py
parentRemove state hack from _create_new_client_event (diff)
downloadsynapse-d76d89323c4b962b4f3ff72a3c9b40f2d2d347b3.tar.xz
Use computed prev event ids
Diffstat (limited to 'synapse/storage/event_federation.py')
-rw-r--r--synapse/storage/event_federation.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/synapse/storage/event_federation.py b/synapse/storage/event_federation.py
index 3489315e0d..0827946207 100644
--- a/synapse/storage/event_federation.py
+++ b/synapse/storage/event_federation.py
@@ -163,6 +163,22 @@ class EventFederationStore(SQLBaseStore):
             room_id,
         )
 
+    @defer.inlineCallbacks
+    def get_max_depth_of_events(self, event_ids):
+        sql = (
+            "SELECT MAX(depth) FROM events WHERE event_id IN (%s)"
+        ) % (",".join(["?"] * len(event_ids)),)
+
+        rows = yield self._execute(
+            "get_max_depth_of_events", None,
+            sql, *event_ids
+        )
+
+        if rows:
+            defer.returnValue(rows[0][0])
+        else:
+            defer.returnValue(1)
+
     def _get_min_depth_interaction(self, txn, room_id):
         min_depth = self._simple_select_one_onecol_txn(
             txn,