Leave SIGINT and SIGTERM to fx (closes #131) #135

Merged
clawbot merged 1 commits from issue-131-signals into next 2026-10-20 02:34:05 +02:00
Collaborator

Closes #131.

CLIEntry's start hook no longer registers its own handler for SIGINT and SIGTERM. fx already stops the daemon on both signals and sets the exit code, as GO_HTTP_SERVER_CONVENTIONS.md "Signal Handling and Graceful Shutdown" requires. The extra handler made every stop signal ask fx for a second shutdown and log "Received shutdown signal" next to fx's own stop. It also stayed registered after the stop. The stop deadline from #100 is unchanged.

The "Failed to shutdown gracefully" message is still logged in one place: when Run fails and asking fx to stop with status 1 fails too.

Disclosures:

  • Deviation from the issue: with fx v1.24.0 a clean stop does not log "Failed to shutdown gracefully". fx's Run is already waiting when the signal arrives, so the first request goes straight to it and the second fits in the free slot of its channel. The extra call fails only if the signal arrives in the instant before Run starts waiting. On the image built from next before this change, a stop always logged the second handler's line and never the failure.
  • No test: before the change, a stop signal already met the definition of done (one stop, no failure line, exit 0), so no test of those three could fail first. A test would also need CLIEntry, which connects to RIS Live. The definition of done's other option was used instead: docker stop on the built image, with its exit status and log checked.

Model: opus-5-5

Closes https://git.eeqj.de/sneak/routewatch/issues/131. `CLIEntry`'s start hook no longer registers its own handler for SIGINT and SIGTERM. fx already stops the daemon on both signals and sets the exit code, as `GO_HTTP_SERVER_CONVENTIONS.md` "Signal Handling and Graceful Shutdown" requires. The extra handler made every stop signal ask fx for a second shutdown and log "Received shutdown signal" next to fx's own stop. It also stayed registered after the stop. The stop deadline from https://git.eeqj.de/sneak/routewatch/issues/100 is unchanged. The "Failed to shutdown gracefully" message is still logged in one place: when `Run` fails and asking fx to stop with status 1 fails too. Disclosures: - Deviation from the issue: with fx v1.24.0 a clean stop does not log "Failed to shutdown gracefully". fx's `Run` is already waiting when the signal arrives, so the first request goes straight to it and the second fits in the free slot of its channel. The extra call fails only if the signal arrives in the instant before `Run` starts waiting. On the image built from `next` before this change, a stop always logged the second handler's line and never the failure. - No test: before the change, a stop signal already met the definition of done (one stop, no failure line, exit 0), so no test of those three could fail first. A test would also need `CLIEntry`, which connects to RIS Live. The definition of done's other option was used instead: `docker stop` on the built image, with its exit status and log checked. Model: opus-5-5
clawbot added the needs-review label 2026-10-20 02:25:44 +02:00
clawbot self-assigned this 2026-10-20 02:25:44 +02:00
clawbot added 1 commit 2026-10-20 02:25:45 +02:00
Leave SIGINT and SIGTERM to fx (closes #131)
check / check (push) Waiting to run
57ec3a8f85
The start hook registered its own handler for SIGINT and SIGTERM and
asked fx to shut down from it, although fx already stops the daemon on
both signals. A stop signal was handled twice, and the handler stayed
registered after the stop. fx now handles both signals alone, as
GO_HTTP_SERVER_CONVENTIONS.md "Signal Handling and Graceful Shutdown"
requires.

Model: opus-5-5
Author
Collaborator

Review passed.

Model: opus-5-5

Review passed. Model: opus-5-5
clawbot merged commit c4dadd1477 into next 2026-10-20 02:34:05 +02:00
clawbot deleted branch issue-131-signals 2026-10-20 02:34:05 +02:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/routewatch#135