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

Function waitForService

scripts/dev-static.mjs:268–286  ·  view source on GitHub ↗
(name, url, timeoutMs = 30000)

Source from the content-addressed store, hash-verified

266}
267
268async function waitForService(name, url, timeoutMs = 30000) {
269 const start = Date.now();
270
271 while (Date.now() - start < timeoutMs) {
272 try {
273 const res = await fetch(url);
274 if (res.ok) {
275 logService(name, `Ready at ${url}`, c.green);
276 return true;
277 }
278 } catch {
279 // Keep trying
280 }
281 await delay(500);
282 }
283
284 logService(name, `Timeout waiting for ${url}`, c.red);
285 return false;
286}
287
288// ═══════════════════════════════════════════════════════════════════════════
289// Service Starters (agent-server + automation are byte-for-byte the same as

Callers 1

mainFunction · 0.70

Calls 2

delayFunction · 0.85
logServiceFunction · 0.70

Tested by

no test coverage detected