summary refs log tree commit diff
diff options
context:
space:
mode:
authorOlivier Wilkinson (reivilibre) <oliverw@matrix.org>2022-12-20 18:30:47 +0000
committerOlivier Wilkinson (reivilibre) <oliverw@matrix.org>2022-12-20 18:30:47 +0000
commitcbf1cebef304190fda5bf90f1268e6238eb26888 (patch)
treeec9a9c2063fd0282d9b7deb97301e2415527cfe3
parentMerge branch 'master' into develop (diff)
downloadsynapse-rei/jumptodate_statement_limit.tar.xz
Mitigate jump to date slowness by adding 30s timeout github/rei/jumptodate_statement_limit rei/jumptodate_statement_limit
-rw-r--r--synapse/storage/databases/main/events_worker.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/synapse/storage/databases/main/events_worker.py b/synapse/storage/databases/main/events_worker.py
index 761b15a815..f80b494edb 100644
--- a/synapse/storage/databases/main/events_worker.py
+++ b/synapse/storage/databases/main/events_worker.py
@@ -2276,6 +2276,10 @@ class EventsWorkerStore(SQLBaseStore):
         """
 
         def get_event_id_for_timestamp_txn(txn: LoggingTransaction) -> Optional[str]:
+            if isinstance(self.database_engine, PostgresEngine):
+                # Temporary: make sure these queries can't last more than 30s
+                txn.execute("SET LOCAL statement_timeout = 30000")
+
             txn.execute(
                 sql_template,
                 (room_id, timestamp),