MCPcopy Index your code
hub / github.com/NativeScript/SimDeck / waitForHealth

Function waitForHealth

scripts/integration/cli.mjs:747–760  ·  view source on GitHub ↗
(options = {})

Source from the content-addressed store, hash-verified

745}
746
747async function waitForHealth(options = {}) {
748 const deadline = Date.now() + (options.timeoutMs ?? 30_000);
749 while (Date.now() < deadline) {
750 try {
751 const health = await httpJson("GET", "/api/health");
752 if (health.httpPort === serverPort) {
753 return;
754 }
755 } catch {
756 await sleep(250);
757 }
758 }
759 throw new Error("Timed out waiting for SimDeck integration server.");
760}
761
762function simdeckJson(args, options = {}) {
763 return JSON.parse(simdeckText(args, options));

Callers 3

mainFunction · 0.70
retrySimdeckJsonFunction · 0.70
retrySimdeckTextFunction · 0.70

Calls 2

httpJsonFunction · 0.70
sleepFunction · 0.70

Tested by

no test coverage detected