Disable statement timeout whilst purging rooms (#16455)
* Disable statement timeout whilst purging rooms * Newsfile Signed-off-by: Olivier Wilkinson (reivilibre) <oliverw@matrix.org> * Note the introduction version --------- Signed-off-by: Olivier Wilkinson (reivilibre) <oliverw@matrix.org>
This commit is contained in:
parent
a6abee36bc
commit
8902b3031d
|
@ -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.
|
|
@ -89,6 +89,11 @@ class PurgeEventsStore(StateGroupWorkerStore, CacheInvalidationWorkerStore):
|
||||||
# furthermore, we might already have the table from a previous (failed)
|
# furthermore, we might already have the table from a previous (failed)
|
||||||
# purge attempt, so let's drop the table first.
|
# 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("DROP TABLE IF EXISTS events_to_purge")
|
||||||
|
|
||||||
txn.execute(
|
txn.execute(
|
||||||
|
|
Loading…
Reference in New Issue