Skip to content

Commit

Permalink
[Namespace]: Remove key exists check in dbs_get_all
Browse files Browse the repository at this point in the history
to reduce time taken.

Signed-off-by: SuvarnaMeenakshi <sumeenak@microsoft.com>
  • Loading branch information
SuvarnaMeenakshi committed Jul 10, 2020
1 parent 253f58e commit 16f36d8
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/sonic_ax_impl/mibs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -552,12 +552,16 @@ def dbs_get_all(dbs, db_name, _hash, *args, **kwargs):
db get_all function executed on global and all namespace DBs.
"""
result = {}
Namespace.connect_all_dbs(dbs, db_name)
if len(dbs) == 1:
return dbs[0].get_all(db_name, _hash, *args, **kwargs)
for db_conn in dbs:
db_conn.connect(db_name)
if(db_conn.exists(db_name, _hash)):
ns_result = db_conn.get_all(db_name, _hash, *args, **kwargs)
if ns_result is not None:
result.update(ns_result)
# If there are multiple namespaces, _hash might not be
# present in all namespace, ignore if not present in a
# specfic namespace.
ns_result = db_conn.get_all(db_name, _hash, blocking=False)
if ns_result is not None:
result.update(ns_result)
return result

@staticmethod
Expand Down

0 comments on commit 16f36d8

Please sign in to comment.