Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Disable statement timeout whilst purging rooms (#16455)
Browse files Browse the repository at this point in the history
* Disable statement timeout whilst purging rooms

* Newsfile

Signed-off-by: Olivier Wilkinson (reivilibre) <[email protected]>

* Note the introduction version

---------

Signed-off-by: Olivier Wilkinson (reivilibre) <[email protected]>
  • Loading branch information
reivilibre authored Oct 9, 2023
1 parent a6abee3 commit 8902b30
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions changelog.d/16455.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Prevent the purging of large rooms from timing out when Postgres is in use. The timeout which causes this issue was introduced in Synapse 1.88.0.
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 @@ -89,6 +89,11 @@ def _purge_history_txn(
# furthermore, we might already have the table from a previous (failed)
# purge attempt, so let's drop the table first.

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")

txn.execute("DROP TABLE IF EXISTS events_to_purge")

txn.execute(
Expand Down

0 comments on commit 8902b30

Please sign in to comment.