summary refs log tree commit diff
path: root/synapse/storage
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2016-09-21 15:20:56 +0100
committerErik Johnston <erik@matrix.org>2016-09-21 15:20:56 +0100
commit0b78d8adf26d5890c4b50510bdfc04e08804ace2 (patch)
tree710d859063734871bd69d6c24feffb9af029e7a0 /synapse/storage
parentMerge pull request #1131 from matrix-org/matthew/e2e-notifs (diff)
downloadsynapse-0b78d8adf26d5890c4b50510bdfc04e08804ace2.tar.xz
Fix _delete_old_forward_extrem_cache query
Diffstat (limited to 'synapse/storage')
-rw-r--r--synapse/storage/event_federation.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/synapse/storage/event_federation.py b/synapse/storage/event_federation.py
index 3d62451de9..7a02bf5e63 100644
--- a/synapse/storage/event_federation.py
+++ b/synapse/storage/event_federation.py
@@ -398,12 +398,11 @@ class EventFederationStore(SQLBaseStore):
             sql = ("""
                 DELETE FROM stream_ordering_to_exterm
                 WHERE
-                (
-                    SELECT max(stream_ordering) AS stream_ordering
+                room_id IN (
+                    SELECT room_id AS stream_ordering
                     FROM stream_ordering_to_exterm
-                    WHERE room_id = stream_ordering_to_exterm.room_id
-                ) > ?
-                AND stream_ordering < ?
+                    WHERE stream_ordering > ?
+                ) AND stream_ordering < ?
             """)
             txn.execute(
                 sql,