Add SIGINT/SIGTERM handlers for graceful and timely shutdown.#14
Conversation
|
Warning Review limit reached
More reviews will be available in 28 minutes and 17 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (7)
📝 WalkthroughWalkthroughThe server now enables Tokio signal support, starts Axum with graceful shutdown, and awaits a new shutdown future that listens for SIGINT and SIGTERM. ChangesGraceful shutdown
Sequence Diagram(s)sequenceDiagram
participant main
participant Serve as "axum::serve(...).with_graceful_shutdown(shutdown())"
participant Shutdown as "shutdown()"
participant CtrlC as "tokio::signal::ctrl_c()"
participant Terminate as "tokio::signal::unix::signal(SignalKind::terminate())"
main->>Serve: start server
Serve->>Shutdown: await shutdown()
Shutdown->>CtrlC: listen for SIGINT
Shutdown->>Terminate: listen for SIGTERM
CtrlC-->>Shutdown: Ctrl-C received
Terminate-->>Shutdown: SIGTERM received
Shutdown-->>Serve: resolve
Serve-->>main: exit
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/main.rs`:
- Line 87: The ctrl-c handler setup in main has a typo in the expect message,
making the panic text unclear if it ever triggers. Update the expect call on
ctrl_c in main to use a plain, correctly spelled message like “failed to install
sigint handler” so the error reads clearly when signal::ctrl_c() fails.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 17f4b5a3-2aa1-4719-9188-e2f511ac4eaa
⛔ Files ignored due to path filters (1)
Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (2)
Cargo.tomlsrc/main.rs
📜 Review details
⏰ Context from checks skipped due to timeout. (2)
- GitHub Check: build (cpu)
- GitHub Check: Analyze (rust)
🔇 Additional comments (3)
Cargo.toml (1)
21-21: LGTM!src/main.rs (2)
40-40: LGTM!
84-97: LGTM!
d03fdfd to
d744b05
Compare
d744b05 to
882bc71
Compare
Summary by CodeRabbit