summary refs log tree commit diff
path: root/synapse/storage/database.py
diff options
context:
space:
mode:
authorOlivier Wilkinson (reivilibre) <oliverw@matrix.org>2021-11-09 11:58:35 +0000
committerOlivier Wilkinson (reivilibre) <oliverw@matrix.org>2021-11-09 11:58:35 +0000
commit9d3b04e7495e147829a09c56a9e5762467d18b78 (patch)
tree39cd3fadcbc3e3be8c89777099724643730c5df1 /synapse/storage/database.py
parentMerge remote-tracking branch 'origin/release-v1.46' into matrix-org-hotfixes (diff)
parentInclude cross-signing signatures when syncing remote devices for the first ti... (diff)
downloadsynapse-9d3b04e7495e147829a09c56a9e5762467d18b78.tar.xz
Merge branch 'release-v1.47' into matrix-org-hotfixes
Diffstat (limited to 'synapse/storage/database.py')
-rw-r--r--synapse/storage/database.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/synapse/storage/database.py b/synapse/storage/database.py

index fa4e89d35c..d4cab69ebf 100644 --- a/synapse/storage/database.py +++ b/synapse/storage/database.py
@@ -48,6 +48,7 @@ from synapse.logging.context import ( current_context, make_deferred_yieldable, ) +from synapse.metrics import register_threadpool from synapse.metrics.background_process_metrics import run_as_background_process from synapse.storage.background_updates import BackgroundUpdater from synapse.storage.engines import BaseDatabaseEngine, PostgresEngine, Sqlite3Engine @@ -104,13 +105,17 @@ def make_pool( LoggingDatabaseConnection(conn, engine, "on_new_connection") ) - return adbapi.ConnectionPool( + connection_pool = adbapi.ConnectionPool( db_config.config["name"], cp_reactor=reactor, cp_openfun=_on_new_connection, **db_args, ) + register_threadpool(f"database-{db_config.name}", connection_pool.threadpool) + + return connection_pool + def make_conn( db_config: DatabaseConnectionConfig, @@ -441,6 +446,10 @@ class DatabasePool: self._check_safe_to_upsert, ) + def name(self) -> str: + "Return the name of this database" + return self._database_config.name + def is_running(self) -> bool: """Is the database pool currently running""" return self._db_pool.running