Bounded /health probe. Returns true if the server answers within `attempts` * tries spaced `backoffMs` apart — distinguishes a busy-but-alive daemon from a * dead one (#1781) so a slow server isn't killed and restarted into a crash-loop.
(port: number, attempts = 3, backoffMs = 250)
| 249 | * tries spaced `backoffMs` apart — distinguishes a busy-but-alive daemon from a |
| 250 | * dead one (#1781) so a slow server isn't killed and restarted into a crash-loop. */ |
| 251 | async function probeHealthWithBackoff(port: number, attempts = 3, backoffMs = 250): Promise<boolean> { |
| 252 | for (let i = 0; i < attempts; i++) { |
| 253 | if (await isServerHealthy(port)) return true; |
| 254 | if (i < attempts - 1) await Bun.sleep(backoffMs); |
| 255 | } |
| 256 | return false; |
| 257 | } |
| 258 | |
| 259 | /** |
| 260 | * Build the env for an auto-restart after a crash. headed/proxy/configHash are |
no test coverage detected