Skip to content

Commit

Permalink
Disable statement timeout during room purge (#18017)
Browse files Browse the repository at this point in the history
This is already done for `purge_history` but seems to have been
forgotten for `purge_room`.
  • Loading branch information
MatMaul authored Dec 19, 2024
1 parent bd9a107 commit 234d07e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions changelog.d/18017.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Disable DB statement timeout when doing a purge room since it can be quite long.
5 changes: 5 additions & 0 deletions synapse/storage/databases/main/purge_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,11 @@ def _purge_room_txn(self, txn: LoggingTransaction, room_id: str) -> List[int]:
(room_id,),
)

if isinstance(self.database_engine, PostgresEngine):
# Disable statement timeouts for this transaction; purging rooms can
# take a while!
txn.execute("SET LOCAL statement_timeout = 0")

# First, fetch all the state groups that should be deleted, before
# we delete that information.
txn.execute(
Expand Down

0 comments on commit 234d07e

Please sign in to comment.