Avoid double read in configloader

We read the file data twice from ZK when we only nead to read it
once.  This patch corrects that.

Change-Id: Icb51fd892429577d671521fd148dbaba2d457827
This commit is contained in:
James E. Blair 2024-06-09 06:58:38 -07:00
parent dddcdeb850
commit 9b475efd8c

View File

@ -2295,12 +2295,12 @@ class TenantParser(object):
for conf_root in (ZUUL_CONF_ROOT + tpc.extra_config_files
+ tpc.extra_config_dirs):
for fn in sorted(files.keys()):
if not files.get(fn):
continue
if not (fn == conf_root
or (conf_root in valid_dirs
and fn.startswith(f"{conf_root}/"))):
continue
if not (file_data := files.get(fn)):
continue
# Warn if there is more than one configuration in a
# project-branch (unless an "extra" file/dir). We
# continue to add the data to the cache for use by
@ -2323,7 +2323,7 @@ class TenantParser(object):
local_accumulator = error_accumulator.extend(
source_context=source_context)
incdata = self.loadProjectYAML(
files[fn], source_context, local_accumulator)
file_data, source_context, local_accumulator)
branch_cache.put(source_context.path, incdata, ltime)
branch_cache.setValidFor(tpc, ZUUL_CONF_ROOT, ltime)
if min_ltimes is not None: