(name, url, timeoutMs = 30000)
| 287 | } |
| 288 | |
| 289 | async function waitForService(name, url, timeoutMs = 30000) { |
| 290 | const start = Date.now(); |
| 291 | |
| 292 | while (Date.now() - start < timeoutMs) { |
| 293 | try { |
| 294 | const res = await fetch(url); |
| 295 | if (res.ok) { |
| 296 | logService(name, `Ready at ${url}`, c.green); |
| 297 | return true; |
| 298 | } |
| 299 | } catch { |
| 300 | // Keep trying |
| 301 | } |
| 302 | await delay(500); |
| 303 | } |
| 304 | |
| 305 | logService(name, `Timeout waiting for ${url}`, c.red); |
| 306 | return false; |
| 307 | } |
| 308 | |
| 309 | // ═══════════════════════════════════════════════════════════════════════════ |
| 310 | // Service Starters (agent-server + automation are byte-for-byte the same as |
no test coverage detected