salvo-graceful-shutdown

Handle Ctrl+C and SIGTERM signals to finish in-flight requests before stopping Salvo servers.

20|5|Updated Jan 11, 2026
One-click install
npx skills add https://github.com/salvo-rs/salvo-skills --skill salvo-graceful-shutdown
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: salvo-graceful-shutdown
Source: https://github.com/salvo-rs/salvo-skills/tree/main/skills/salvo-graceful-shutdown
Command: npx skills add https://github.com/salvo-rs/salvo-skills --skill salvo-graceful-shutdown

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Graceful shutdown ensures in-flight requests complete before the server stops, preventing abrupt drops and data inconsistency.

Core Features & Use Cases

  • Cross-platform signal handling (Ctrl+C, SIGTERM) to initiate shutdown
  • Timed graceful stop with ServerHandle::stop_graceful to wait for in-flight requests
  • Health-check integration and readiness signals to cooperate with load balancers and orchestrators
  • Cleanup tasks executed before shutdown to release resources

Quick Start

Register a shutdown listener that triggers a graceful stop with a timeout when a termination signal is received.

Frequently Asked Questions about salvo-graceful-shutdown

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement graceful shutdown in a Salvo web server?

Graceful shutdown in a Salvo web server is implemented by registering a listener that triggers ServerHandle::stop_graceful upon receiving termination signals. This mechanism waits for in-flight requests to complete before stopping the server, ensuring zero-downtime updates.

What is graceful shutdown and why do I need it for production web servers?

Graceful shutdown is the process of finishing in-flight requests before a server stops, preventing abrupt connection drops and data inconsistency. You need it for production web servers to maintain data integrity during deployments, Kubernetes pod terminations, or manual restarts.

Does Salvo support cross-platform signal handling for Kubernetes lifecycle events?

Yes, Salvo supports cross-platform signal handling for Kubernetes lifecycle events by integrating with tokio::signal. It captures Ctrl+C and SIGTERM signals to initiate a timed graceful stop, coordinating readiness checks with load balancers and orchestrators.

How do I run cleanup tasks before a Salvo server stops?

You run cleanup tasks before a Salvo server stops by registering them within the shutdown listener logic. When a termination signal is received, the server executes these optional cleanup tasks to release resources before finalizing the graceful shutdown process.

What's the best way to handle SIGTERM and readiness checks with Salvo and Tokio?

The best way to handle SIGTERM and readiness checks with Salvo and Tokio is using ServerHandle::stop_graceful. It intercepts cross-platform signals via tokio::signal, cooperates with load balancers through health-check integration, and waits for a timed graceful stop.