Disable statement timeout during room purge (#18017)

This is already done for `purge_history` but seems to have been
forgotten for `purge_room`.
This commit is contained in:
Mathieu Velten 2024-12-19 14:02:06 +00:00 committed by GitHub
parent bd9a1079bc
commit 234d07eb09
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 0 deletions

1
changelog.d/18017.misc Normal file
View File

@ -0,0 +1 @@
Disable DB statement timeout when doing a purge room since it can be quite long.

View File

@ -376,6 +376,11 @@ class PurgeEventsStore(StateGroupWorkerStore, CacheInvalidationWorkerStore):
(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(