8356
Wx
www-xonecas-io / files
www-xonecas-io / tickets / 1047-git-push-waits-for-the-whole-site-rebuild.md
1.5 KB
1--- 2id: 1047 3title: git push waits for the whole site rebuild 4type: bug 5status: inbox 6priority: p2 7area: site 8created: 2026-11-08T20:15:00Z 9updated: 2026-11-08T20:51:07Z 10source: agent 11moves: 2026-11-08T20:16:37Z inbox doing drag; 2026-11-08T20:51:07Z doing inbox drag 12--- 13 14`git push` to a hosted repo does not return until the post-receive rebuild ends. On the VPS the first push to `www-xonecas-io.git` took about 3m40s (20:06:12 to 20:09:54), and the client's ssh session stayed open the whole time. The hook is meant to run the build in the background so the push returns at once. 15 16Cause: the hook line from `cmd/site/remote.go:94` is 17 18``` 19cd '<site>' && flock '<lock>' sh -c '<build>' < /dev/null >> '<build.log>' 2>&1 & 20``` 21 22The redirects apply only to `flock`. The `&` runs the whole `cd && flock` list in a subshell, and that subshell keeps the hook's stdout and stderr, a pipe to `git receive-pack`. receive-pack waits for the pipe to close, so the push waits for the build. Seen on the VPS: `/bin/sh hooks/post-receive` (ppid 1) held fd 1 and 2 on the same pipe while `site build` ran. 23 24Fix direction, not tested: put the redirects on the whole list, for example `(cd '<site>' && flock ...) < /dev/null >> '<build.log>' 2>&1 &`. 25 26Already created repos keep the old line in their `hooks/post-receive`. On the VPS that is `~/repos/www-xonecas-io/repos/xonecas.io/www-xonecas-io.git/hooks/post-receive`. A code fix does not change them. 27 28Not checked: whether the client times out on a longer build.