merge testing->tomerge/main #7

Open
anti wants to merge 242 commits from testing into tomerge/main
2 changed files with 10 additions and 4 deletions
Showing only changes of commit dbaccde143 - Show all commits

View File

@@ -136,8 +136,12 @@ async def api_push_update(
) -> PushUpdateResponse:
targets = await _resolve_targets(repo, req)
tree_root = _master_tree_root()
sha = detect_git_sha(tree_root)
tarball = tar_working_tree(tree_root, extra_excludes=req.exclude)
# Both `detect_git_sha` (shells out) and `tar_working_tree` (walks the repo
# + gzips a few MB) are synchronous CPU+I/O. Running them directly on the
# event loop blocks every other request until the tarball is built — the
# dashboard freezes on /swarm-updates push. Offload to a worker thread.
sha = await asyncio.to_thread(detect_git_sha, tree_root)
tarball = await asyncio.to_thread(tar_working_tree, tree_root, extra_excludes=req.exclude)
log.info(
"swarm_updates.push sha=%s tarball=%d hosts=%d include_self=%s",
sha or "(not a git repo)", len(tarball), len(targets), req.include_self,

View File

@@ -76,8 +76,10 @@ async def api_push_update_self(
) -> PushUpdateResponse:
targets = await _resolve_targets(repo, req)
tree_root = _master_tree_root()
sha = detect_git_sha(tree_root)
tarball = tar_working_tree(tree_root, extra_excludes=req.exclude)
# Offload sync I/O (git shell-out + tar+gzip of the repo) so the event
# loop stays responsive while the tarball is being built.
sha = await asyncio.to_thread(detect_git_sha, tree_root)
tarball = await asyncio.to_thread(tar_working_tree, tree_root, extra_excludes=req.exclude)
log.info(
"swarm_updates.push_self sha=%s tarball=%d hosts=%d",
sha or "(not a git repo)", len(tarball), len(targets),