summary refs log tree commit diff
path: root/synapse/storage/engines/psycopg2.py
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 14:29:22 -0500
commit17ba1a9c1e353f85e464d584a036558997fe1f34 (patch)
tree67aec6e180a7df48f4750999efed3ecf4292ba54 /synapse/storage/engines/psycopg2.py
parentRun tests in CI against psycopg. (diff)
downloadsynapse-github/clokep/psycopg3-driver.tar.xz
Method to set statement timeout. github/clokep/psycopg3-driver clokep/psycopg3-driver
Diffstat (limited to 'synapse/storage/engines/psycopg2.py')
-rw-r--r--synapse/storage/engines/psycopg2.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/synapse/storage/engines/psycopg2.py b/synapse/storage/engines/psycopg2.py

index e8af8c2c48..efb66778f9 100644 --- a/synapse/storage/engines/psycopg2.py +++ b/synapse/storage/engines/psycopg2.py
@@ -51,6 +51,11 @@ class Psycopg2Engine( def get_server_version(self, db_conn: psycopg2.extensions.connection) -> int: return db_conn.server_version + def set_statement_timeout( + self, cursor: psycopg2.extensions.cursor, statement_timeout: int + ) -> None: + cursor.execute("SET statement_timeout TO ?", (statement_timeout,)) + def convert_param_style(self, sql: str) -> str: return sql.replace("?", "%s")