MCPcopy Create free account
hub / github.com/OpenHands/OpenHands / waitForServer

Function waitForServer

scripts/dev-extra-backend.mjs:80–97  ·  view source on GitHub ↗
(url, timeoutMs = DEFAULT_WAIT_TIMEOUT_MS)

Source from the content-addressed store, hash-verified

78}
79
80async function waitForServer(url, timeoutMs = DEFAULT_WAIT_TIMEOUT_MS) {
81 const startedAt = Date.now();
82
83 while (Date.now() - startedAt < timeoutMs) {
84 try {
85 const response = await fetch(url);
86 if (response.ok) {
87 return;
88 }
89 } catch {
90 // Keep polling until timeout.
91 }
92
93 await delay(500);
94 }
95
96 throw new Error(`Timed out waiting for agent-server at ${url}`);
97}
98
99function spawnProcess(command, args, options = {}) {
100 const child = spawn(

Callers 1

mainFunction · 0.70

Calls 1

delayFunction · 0.85

Tested by

no test coverage detected