Merge pull request #2838 from coreos-inc/add-configurable-flags

Add configurable stale_timeout and max_connections on pool
This commit is contained in:
josephschorr 2017-07-27 15:29:06 -04:00 committed by GitHub
commit bfc2a06774

View file

@ -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)