summary refs log tree commit diff
path: root/synapse/storage/databases/main
diff options
context:
space:
mode:
authorPatrick Cloke <patrickc@matrix.org>2023-11-15 13:38:57 -0500
committerPatrick Cloke <patrickc@matrix.org>2023-11-15 15:11:51 -0500
commit9622bda16329a1f10daf3f57a75f5444483e0447 (patch)
treeda95a97808b41e16283e9d13f374b5b933798674 /synapse/storage/databases/main
parentAdd an Admin API to temporarily grant the ability to update an existing cross... (diff)
downloadsynapse-github/clokep/statement-timeout.tar.xz
Abstract logic for setting the statement timeout. github/clokep/statement-timeout clokep/statement-timeout
Diffstat (limited to 'synapse/storage/databases/main')
-rw-r--r--synapse/storage/databases/main/purge_events.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/synapse/storage/databases/main/purge_events.py b/synapse/storage/databases/main/purge_events.py

index 1a5b5731bb..56c8198149 100644 --- a/synapse/storage/databases/main/purge_events.py +++ b/synapse/storage/databases/main/purge_events.py
@@ -89,10 +89,11 @@ class PurgeEventsStore(StateGroupWorkerStore, CacheInvalidationWorkerStore): # 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") + # Disable statement timeouts for this transaction; purging rooms can + # take a while! + self.database_engine.attempt_to_set_statement_timeout( + txn, 0, for_transaction=True + ) txn.execute("DROP TABLE IF EXISTS events_to_purge")