mirror of
https://github.com/garrytan/gstack.git
synced 2026-09-16 01:45:29 +02:00
fix(browse): daemon resilience on loaded machines — Bun conn errors, stop/restart flush, startup + git-root budgets
Four load-sensitivity fixes in the daemon lifecycle:
- sendCommand only recognized Node's ECONNREFUSED/ECONNRESET; the compiled
CLI runs on Bun, which reports 'ConnectionRefused'/'ConnectionClosed'
("Unable to connect..."), so daemon crashes leaked the raw error and
exited 1 instead of entering the busy-check/restart path. Match both.
- stop/restart called shutdown() inline, which exits before the HTTP
response flushes — the CLI saw a dropped socket (and would now
crash-retry a fresh daemon just to stop it). Defer shutdown ~100ms so
the 200 lands first.
- Non-CI POSIX startup budget raised 8s -> 15s (cold Chromium measured
~5.7s at load avg 10; load 12+ blew the old budget while the detached
daemon was still booting).
- getGitRoot's 2s git rev-parse timeout returned null under load (6.3s
spikes measured), scattering state files across cwds into split-brain
daemons. Raise to 8s, still bounded.
Contributed by @mplatts (PR #1732).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
67a96fed9b
commit
a6c94c7feb
@@ -884,7 +884,10 @@ describe('CLI lifecycle', () => {
|
||||
cliEnv.BROWSE_STATE_FILE = stateFile;
|
||||
const result = await new Promise<{ code: number; stdout: string; stderr: string }>((resolve) => {
|
||||
const proc = spawn('bun', ['run', cliPath, 'status'], {
|
||||
timeout: 15000,
|
||||
// Must exceed the CLI's startup budget (resolveStartTimeout, 15s
|
||||
// non-CI POSIX) or a slow cold boot under full-suite load gets the
|
||||
// child killed at the exact moment the CLI would have succeeded.
|
||||
timeout: 18000,
|
||||
env: cliEnv,
|
||||
});
|
||||
let stdout = '';
|
||||
|
||||
Reference in New Issue
Block a user