summary refs log tree commit diff
path: root/synapse/storage/databases/state
diff options
context:
space:
mode:
authorPatrick Cloke <clokep@users.noreply.github.com>2023-11-09 16:19:42 -0500
committerGitHub <noreply@github.com>2023-11-09 16:19:42 -0500
commit2c6a7dfcbfc6e3782c5d2d88b28a54efca8aff8b (patch)
tree535209d624466edcee7aa1027568983bae07ec22 /synapse/storage/databases/state
parentFix a long-standing bug where Synapse would not unbind third-party identifier... (diff)
downloadsynapse-2c6a7dfcbfc6e3782c5d2d88b28a54efca8aff8b.tar.xz
Use attempt_to_set_autocommit everywhere. (#16615)
To avoid asserting the type of the database connection.
Diffstat (limited to 'synapse/storage/databases/state')
-rw-r--r--synapse/storage/databases/state/bg_updates.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/synapse/storage/databases/state/bg_updates.py b/synapse/storage/databases/state/bg_updates.py
index 0f9c550b27..2c3151526d 100644
--- a/synapse/storage/databases/state/bg_updates.py
+++ b/synapse/storage/databases/state/bg_updates.py
@@ -492,7 +492,7 @@ class StateBackgroundUpdateStore(StateGroupBackgroundUpdateStore):
             conn.rollback()
             if isinstance(self.database_engine, PostgresEngine):
                 # postgres insists on autocommit for the index
-                conn.set_session(autocommit=True)
+                conn.engine.attempt_to_set_autocommit(conn.conn, True)
                 try:
                     txn = conn.cursor()
                     txn.execute(
@@ -501,7 +501,7 @@ class StateBackgroundUpdateStore(StateGroupBackgroundUpdateStore):
                     )
                     txn.execute("DROP INDEX IF EXISTS state_groups_state_id")
                 finally:
-                    conn.set_session(autocommit=False)
+                    conn.engine.attempt_to_set_autocommit(conn.conn, False)
             else:
                 txn = conn.cursor()
                 txn.execute(