Database.max_retries only override on sqlalchemy side
Currently, the max_retries parameter will be override in get_connection_from_config function. But it will be used later in safe_mongo_call function. Since the override of max_retries only need on sqlalchemy side, this patch move the override from get_connection_ from_config to storage.impl_sqlalchemy.Connection.__init__ and make sure max_retries can be used on mongoDB side. Change-Id: I83f35c886bc8b7299c1efd7297fdbc980214567f Closes-Bug: #1395972
This commit is contained in:
parent
942fb02a85
commit
afb90e0cfc
|
@ -94,9 +94,6 @@ def get_connection_from_config(conf, purpose=None):
|
|||
if purpose:
|
||||
namespace = 'ceilometer.%s.storage' % purpose
|
||||
url = getattr(conf.database, '%s_connection' % purpose) or url
|
||||
# Set max_retries to 0, since oslo.db in certain cases may attempt to retry
|
||||
# making the db connection retried max_retries ^ 2 times in failure case
|
||||
conf.set_override('max_retries', 0, group='database')
|
||||
return get_connection(url, namespace)
|
||||
|
||||
|
||||
|
|
|
@ -220,6 +220,11 @@ class Connection(base.Connection):
|
|||
)
|
||||
|
||||
def __init__(self, url):
|
||||
# Set max_retries to 0, since oslo.db in certain cases may attempt
|
||||
# to retry making the db connection retried max_retries ^ 2 times
|
||||
# in failure case and db reconnection has already been implemented
|
||||
# in storage.__init__.get_connection_from_config function
|
||||
cfg.CONF.set_override('max_retries', 0, group='database')
|
||||
self._engine_facade = db_session.EngineFacade(
|
||||
url,
|
||||
**dict(cfg.CONF.database.items())
|
||||
|
|
Loading…
Reference in New Issue