cmds.secrets.lib.DistroContext: One SSH session per compile #183
Merged
Jan Lindemannmerged 2 commits from jan/feature/20261120-cmds-secrets-lib-distrocontext-one-ssh-session-per-compile into master2026-11-20 23:12:07 +01:00
AGit
Each run() call opens and closes the exec context, so a compile that issues
one remote command at a time opened and closed the SSH connection for every
command: a single deploy on dynamix opened around a hundred sessions and
took several minutes.
run() opens and closes through the FileContext reference counter, so
holding the context (and the secret store) open for the whole compile turns
the per-command open() / close() pairs into counter bumps, and the
connection is established only once. This commit wraps the target listing
and the per-target loop in an "async with" on both, which drops the counter
to zero at end of scope and closes the contexts.
Assisted-by: unsloth/Qwen3.8-27B-GGUF:Q4_K_M with pi.dev v1.5.2
Signed-off-by: Jan Lindemann <jan@janware.com>
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 <jan@janware.com>