Add graceful shutdown to the HTTP server #1

Closed
opened 2026-06-02 04:26:38 +00:00 by logaritmisk · 0 comments
Owner

server::serve currently calls axum::serve(listener, app).await with no shutdown signal, so it runs forever and is killed abruptly (crates/server/src/lib.rs).

Before the service is deployed for real (self-host is a first-class target, see docs/specs/2026-06-02-mvp-architecture.md §12), wire with_graceful_shutdown to SIGTERM/SIGINT so in-flight requests can drain and the DB pool closes cleanly.

  • Add a shutdown-signal future (SIGTERM + SIGINT / Ctrl-C).
  • Pass it to axum::serve(...).with_graceful_shutdown(...).
  • Optionally close the sqlx pool on shutdown.

Source: Foundation (Plan 0) final review — deferred, non-blocking.

`server::serve` currently calls `axum::serve(listener, app).await` with no shutdown signal, so it runs forever and is killed abruptly (`crates/server/src/lib.rs`). Before the service is deployed for real (self-host is a first-class target, see `docs/specs/2026-06-02-mvp-architecture.md` §12), wire `with_graceful_shutdown` to `SIGTERM`/`SIGINT` so in-flight requests can drain and the DB pool closes cleanly. - [ ] Add a shutdown-signal future (SIGTERM + SIGINT / Ctrl-C). - [ ] Pass it to `axum::serve(...).with_graceful_shutdown(...)`. - [ ] Optionally close the `sqlx` pool on shutdown. _Source: Foundation (Plan 0) final review — deferred, non-blocking._
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: logaritmisk/biggus-dickus#1