From a5819f7da9a28e8807585bee7741f285d49e51e1 Mon Sep 17 00:00:00 2001 From: Azrenbeth <7782548+Azrenbeth@users.noreply.github.com> Date: Mon, 27 Sep 2021 15:09:09 +0100 Subject: Extract dsn parameters earlier --- synapse/storage/database.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'synapse/storage/database.py') diff --git a/synapse/storage/database.py b/synapse/storage/database.py index f5fb1a33de..7f94cb00d6 100644 --- a/synapse/storage/database.py +++ b/synapse/storage/database.py @@ -19,7 +19,6 @@ from collections import defaultdict from sys import intern from time import monotonic as monotonic_time from typing import ( - TYPE_CHECKING, Any, Callable, Collection, @@ -53,9 +52,6 @@ from synapse.storage.background_updates import BackgroundUpdater from synapse.storage.engines import BaseDatabaseEngine, PostgresEngine, Sqlite3Engine from synapse.storage.types import Connection, Cursor -if TYPE_CHECKING: - from psycopg2.extensions import ConnectionInfo - # python 3 does not have a maximum int value MAX_TXN_ID = 2 ** 63 - 1 @@ -435,9 +431,9 @@ class DatabasePool: # We store the connection info for later use when using postgres # (primarily to allow things like the state auto compressor to connect # to the DB). - self.postgres_connection_info: Optional["ConnectionInfo"] = None + self.postgres_connection_info_parameters: Optional[Dict] = None if isinstance(self.engine, PostgresEngine): - self.postgres_connection_info = db_conn.info + self.postgres_connection_info_parameters = db_conn.info.dsn_parameters if self.engine.can_native_upsert: # Check ASAP (and then later, every 1s) to see if we have finished -- cgit 1.5.1