From 65e55a111901a856aa6c38eb238a4a2ffe5f25cb Mon Sep 17 00:00:00 2001 From: Jan Lindemann Date: Thu, 19 Nov 2026 14:37:31 +0100 Subject: [PATCH] cmds.secrets.lib.DistroContext: Batch file listing code The compile phase of a secrets deploy makes one SSH round-trip per package to list the package files. On a host with nine packages, that is nine round-trips. Make match_files() pass the whole name list to pkg_paths() in one call: the distro backends already accept a list and issue a single file-listing command. Assisted-by: unsloth/Qwen3.8-27B-GGUF:Q4_K_M with pi.dev v1.5.2 Signed-off-by: Jan Lindemann --- src/python/jw/pkg/cmds/secrets/lib/DistroContext.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/python/jw/pkg/cmds/secrets/lib/DistroContext.py b/src/python/jw/pkg/cmds/secrets/lib/DistroContext.py index 3006a1a2..de01258f 100644 --- a/src/python/jw/pkg/cmds/secrets/lib/DistroContext.py +++ b/src/python/jw/pkg/cmds/secrets/lib/DistroContext.py @@ -33,11 +33,12 @@ class DistroContext(FilesContext): self.__distro = distro async def match_files(self, pkg_names: Collection[str], pattern: str) -> list[str]: + # -- One query for the whole name list: the distro backends + # accept a list and issue a single file-listing command ret: list[str] = [] - for pkg_name in pkg_names: - for path in await self.__distro.pkg_paths(pkg_name): - if re.match(pattern, path): - ret.append(path) + for path in await self.__distro.pkg_paths(list(pkg_names)): + if re.match(pattern, path): + ret.append(path) return ret async def list_template_files(self, pkg_names: Collection[str]) -> list[str]: