From 6043bf45b41243ef8478fb0a8dd9934a645b6b78 Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Thu, 27 Jul 2017 15:26:26 -0400 Subject: [PATCH] Add configurable stale_timeout and max_connections on pool --- data/database.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/data/database.py b/data/database.py index 8314c8fb2..82f6c1f01 100644 --- a/data/database.py +++ b/data/database.py @@ -275,8 +275,10 @@ 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.debug('Connection pooling enabled') + 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) wrapped_driver = _wrap_for_retry(driver) return wrapped_driver(parsed_url.database, **db_kwargs)