Skip to content

Commit 234d07e

Browse files
authored
Disable statement timeout during room purge (#18017)
This is already done for `purge_history` but seems to have been forgotten for `purge_room`.
1 parent bd9a107 commit 234d07e

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

changelog.d/18017.misc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Disable DB statement timeout when doing a purge room since it can be quite long.

synapse/storage/databases/main/purge_events.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,11 @@ def _purge_room_txn(self, txn: LoggingTransaction, room_id: str) -> List[int]:
376376
(room_id,),
377377
)
378378

379+
if isinstance(self.database_engine, PostgresEngine):
380+
# Disable statement timeouts for this transaction; purging rooms can
381+
# take a while!
382+
txn.execute("SET LOCAL statement_timeout = 0")
383+
379384
# First, fetch all the state groups that should be deleted, before
380385
# we delete that information.
381386
txn.execute(

0 commit comments

Comments
 (0)