1 files changed, 8 insertions, 0 deletions
diff --git a/synapse/storage/database.py b/synapse/storage/database.py
index f5a8f90a0f..7f94cb00d6 100644
--- a/synapse/storage/database.py
+++ b/synapse/storage/database.py
@@ -395,6 +395,7 @@ class DatabasePool:
hs,
database_config: DatabaseConnectionConfig,
engine: BaseDatabaseEngine,
+ db_conn: LoggingDatabaseConnection,
):
self.hs = hs
self._clock = hs.get_clock()
@@ -427,6 +428,13 @@ class DatabasePool:
if isinstance(self.engine, Sqlite3Engine):
self._unsafe_to_upsert_tables.add("user_directory_search")
+ # 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_parameters: Optional[Dict] = None
+ if isinstance(self.engine, PostgresEngine):
+ 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
# background updates of tables that aren't safe to update.
|