Optimize database name getter calls
This commit is contained in:
parent
05a22d5a54
commit
f4a06ad65d
@ -108,8 +108,9 @@ def _get_connection_settings(
|
||||
|
||||
uri_dict = uri_parser.parse_uri(new_entity)
|
||||
|
||||
if uri_dict.get("database"):
|
||||
conn_settings["name"] = uri_dict.get("database")
|
||||
database = uri_dict.get("database")
|
||||
if database:
|
||||
conn_settings["name"] = database
|
||||
|
||||
# Handle URI style connections, only updating connection params which
|
||||
# were explicitly specified in the URI.
|
||||
@ -117,8 +118,9 @@ def _get_connection_settings(
|
||||
uri_dict = uri_parser.parse_uri(entity)
|
||||
resolved_hosts.append(entity)
|
||||
|
||||
if uri_dict.get("database"):
|
||||
conn_settings["name"] = uri_dict.get("database")
|
||||
database = uri_dict.get("database")
|
||||
if database:
|
||||
conn_settings["name"] = database
|
||||
|
||||
for param in ("read_preference", "username", "password"):
|
||||
if uri_dict.get(param):
|
||||
|
Loading…
x
Reference in New Issue
Block a user