summary refs log tree commit diff
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2016-07-15 10:22:09 +0100
committerErik Johnston <erik@matrix.org>2016-07-15 10:22:09 +0100
commiteec9609e962c7fa623e9d09827ad3ffafeca1874 (patch)
tree184993c98807e8e42cd0212d88ce6d3d87915353
parentMerge pull request #921 from matrix-org/erikj/account_deactivate (diff)
downloadsynapse-eec9609e962c7fa623e9d09827ad3ffafeca1874.tar.xz
event_backwards_extremeties may not be empty
-rw-r--r--synapse/storage/events.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/synapse/storage/events.py b/synapse/storage/events.py
index b582942164..59f8061333 100644
--- a/synapse/storage/events.py
+++ b/synapse/storage/events.py
@@ -1411,11 +1411,21 @@ class EventsStore(SQLBaseStore):
                 to_delete
             )
 
+        txn.execute(
+            "SELECT event_id FROM event_backward_extremities WHERE room_id = ?",
+            (room_id,)
+        )
+
+        cur_back_event_ids = [event_id for event_id, in txn.fetchall()]
+
         # Update backward extremeties
         txn.executemany(
             "INSERT INTO event_backward_extremities (room_id, event_id)"
             " VALUES (?, ?)",
-            [(room_id, event_id) for event_id, in new_backwards_extrems]
+            [
+                (room_id, event_id) for event_id, in new_backwards_extrems
+                if event_id not in cur_back_event_ids
+            ]
         )
 
         txn.executemany(