Disable statement timeout during room purge

This commit is contained in:
Mathieu Velten 2024-12-09 16:46:55 +01:00
parent 790ce14e46
commit 775b2de9f0
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(