Skip to content

feat(serve): graceful shutdown on Ctrl+C and SIGTERM - #53

Merged
alshdavid merged 3 commits into
mainfrom
fix/graceful-shutdown
Oct 19, 2026
Merged

alshdavid merged 3 commits into
mainfrom
fix/graceful-shutdown

Conversation

@alshdavid

Copy link
Copy Markdown
Owner

Summary

  • Add platform::shutdown::shutdown_signal(), resolving on Ctrl+C and, on unix, SIGTERM.
  • http1_server now takes a shutdown future and wraps accepted connections in hyper_util::server::graceful::GracefulShutdown, draining in-flight requests before returning.
  • The serve command passes the signal future in, so Ctrl+C no longer kills active requests.

Fixes #29

Checks

  • cargo check, cargo clippy -D warnings, cargo test, cargo xfmt all pass locally.

Drain in-flight connections through hyper-util's GracefulShutdown before
exiting instead of killing requests when the process is interrupted.

Fixes #29
@alshdavid
alshdavid merged commit 26e6187 into main Oct 19, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add graceful shutdown (signal handling + GracefulServer)

1 participant