Skip to content

Commit 7fa2975

Browse files
committed
refactor(update): drop unused post-update bind wait helper
1 parent 5f4a210 commit 7fa2975

1 file changed

Lines changed: 3 additions & 22 deletions

File tree

‎src/update/job.ts‎

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -169,23 +169,6 @@ async function strictRuntimePortAvailable(port: number, hostname = "127.0.0.1"):
169169
return true;
170170
}
171171

172-
async function waitForStrictRuntimeBind(
173-
port: number,
174-
hostname: string,
175-
timeoutMs: number,
176-
sleep: (ms: number) => Promise<void>,
177-
): Promise<boolean> {
178-
const deadline = Date.now() + timeoutMs;
179-
while (Date.now() < deadline) {
180-
if (process.platform === "win32") {
181-
try { dropWindowsTcpRowsForLocalPort(port); } catch { /* best-effort */ }
182-
}
183-
if (await strictRuntimePortAvailable(port, hostname)) return true;
184-
await sleep(500);
185-
}
186-
return false;
187-
}
188-
189172
/**
190173
* Wait until netstat reports no LISTEN owners on `port` AND Node+Bun can bind.
191174
* Dead PIDs still appear as holders while the ghost TCB lives; SetTcpEntry is a
@@ -843,12 +826,10 @@ async function restartAfterUpdate(
843826
}
844827
}
845828
}
846-
const spawnStart = io.spawnStart ?? spawnDetachedStart;
847-
// Production path only: injected spawnStart keeps unit tests deterministic (one call).
848-
// Published `ocx start --port` may spend up to ~30s reclaiming ghost rows; retry on
849-
// missing /healthz, kill the previous detached attempt, and re-wait for a Bun bind.
829+
// Injected spawnStart keeps unit tests deterministic (one call). Production path
830+
// retries on missing /healthz after prepare + ghost-LISTEN clear.
850831
if (io.spawnStart) {
851-
spawnStart(job, job.installer, port);
832+
io.spawnStart(job, job.installer, port);
852833
return;
853834
}
854835
const sleep = io.sleepMs ?? ((ms: number) => new Promise<void>(r => setTimeout(r, ms)));

0 commit comments

Comments
 (0)