From 3bc5840496a895a2c94729ea86ac4ea45dce0aae Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Thu, 11 Jan 2018 16:42:36 -0500 Subject: [PATCH] Extend our logs about whether we are using connection pooling for a DB --- data/database.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/data/database.py b/data/database.py index 6307014ee..c30225e50 100644 --- a/data/database.py +++ b/data/database.py @@ -275,10 +275,13 @@ def _db_from_url(url, db_kwargs, connect_timeout=DEFAULT_DB_CONNECT_TIMEOUT): drivers = _SCHEME_DRIVERS[parsed_url.drivername] driver = drivers.driver if os.getenv('DB_CONNECTION_POOLING', 'false').lower() == 'true': - logger.info('Connection pooling enabled') driver = drivers.pooled_driver db_kwargs['stale_timeout'] = db_kwargs.get('stale_timeout', None) db_kwargs['max_connections'] = db_kwargs.get('max_connections', None) + logger.info('Connection pooling enabled for %s; stale timeout: %s; max connection count: %s', + parsed_url.drivername, db_kwargs['stale_timeout'], db_kwargs['max_connections']) + else: + logger.info('Connection pooling disabled for %s', parsed_url.drivername) wrapped_driver = _wrap_for_retry(driver) return wrapped_driver(parsed_url.database, **db_kwargs)