summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2019-05-30 15:26:38 +0100
committerErik Johnston <erik@matrix.org>2019-05-30 15:26:38 +0100
commite2c46ed851599dc08cc8a822e07c0d4f9a050ee2 (patch)
tree4e195648073f3112d5a7b9edcb5821630b680f57 /synapse
parentFetch membership counts all at once (diff)
downloadsynapse-e2c46ed851599dc08cc8a822e07c0d4f9a050ee2.tar.xz
Move deletion from table inside txn
Diffstat (limited to 'synapse')
-rw-r--r--synapse/storage/stats.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/synapse/storage/stats.py b/synapse/storage/stats.py
index 727f60b3bd..a99637d4b4 100644
--- a/synapse/storage/stats.py
+++ b/synapse/storage/stats.py
@@ -254,10 +254,13 @@ class StatsStore(StateDeltasStore):
                     {"room_id": room_id, "token": current_token},
                 )
 
+                # We've finished a room. Delete it from the table.
+                self._simple_delete_one_txn(
+                    txn, TEMP_TABLE + "_rooms", {"room_id": room_id},
+                )
+
             yield self.runInteraction("update_room_stats", _fetch_data)
 
-            # We've finished a room. Delete it from the table.
-            yield self._simple_delete_one(TEMP_TABLE + "_rooms", {"room_id": room_id})
             # Update the remaining counter.
             progress["remaining"] -= 1
             yield self.runInteraction(