I’m looking into the best way to achieve a graceful shutdown when using @effect/platform-node's NodeHttpServer and NodeRuntime.runMain.
Current Observation:
When using NodeRuntime.runMain(program), receiving a SIGINT or SIGTERM immediately interrupts the root fiber. This causes the server scope to close and immediately kills any in-flight HTTP requests.
Desired Behavior:
When a shutdown signal is received, I'd like the server to:
1. Immediately start rejecting new incoming requests (e.g., with a 503 Service Unavailable).
2. Wait for all currently active request fibers to finish before allowing the process to exit.
Is there an idiomatic way to achieve this with the current API?