MCPcopy Create free account
hub / github.com/acoyfellow/cloudbox / waitForHealth

Function waitForHealth

scripts/runner-smoke.mjs:36–48  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

34}
35
36async function waitForHealth() {
37 const deadline = Date.now() + READY_TIMEOUT_MS;
38 while (Date.now() < deadline) {
39 try {
40 const res = await fetch(`http://127.0.0.1:${PORT}/health`);
41 if (res.ok) return;
42 } catch {
43 // not ready yet
44 }
45 await wait(500);
46 }
47 throw new Error(`runner did not become healthy within ${READY_TIMEOUT_MS}ms`);
48}
49
50async function postRun() {
51 const ctrl = new AbortController();

Callers 1

mainFunction · 0.85

Calls 1

fetchFunction · 0.50

Tested by

no test coverage detected