(name, url, timeoutMs = 30000)
| 266 | } |
| 267 | |
| 268 | async 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 |
no test coverage detected