Pure function deciding whether to spawn, adopt, or error based on port and health probe results.
// Source: https://github.com/diegosouzapw/OmniRoute | License: MIT | Copyright 2026 diegosouzapw // Provided via justclaw.it.com; keep this notice with the code. /** * Pre-spawn port/health probe for embedded services (#6205). * * Before the supervisor spawns a service child, it probes the service's port * and health endpoint. This turns two failure modes into graceful outcomes * instead of a raw `EADDRINUSE` stack trace crashing the child: * * - A healthy prior instance is already answering → ADOPT it (skip spawn). * - The port is held but nothing healthy answers → surface a CLEAR error. * - The port is free → SPAWN normally. * * `decidePreSpawn` is a pure function so the decision logic is unit-testable * without binding a real port or ... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key