Repository navigation
Fix shutdown message and improve it - #1487
Merged
josecelano merged 8 commits intoApr 29, 2025
Merged
josecelano merged 8 commits into
josecelano merged 8 commits into
Conversation
…ions closed Instead of waiting 90 seconds.
Graceful shutdown now enforces a hard timeout 5 seconds after the grace period. Prevents indefinite waits when connections remain open too long.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #1487 +/- ##
===========================================
- Coverage 84.33% 84.29% -0.04%
===========================================
Files 251 255 +4
Lines 19821 19878 +57
Branches 19821 19878 +57
===========================================
+ Hits 16716 16757 +41
- Misses 2798 2806 +8
- Partials 307 315 +8 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…vent listeners The "jobs" folder should contain all the jogs run by the main app.
This fixes the problem of adding the jobs for event listeners in the
main app JoinHandle vector. It was not possible to add the handles for
those tokio tasks becuase in the main app we wait for all jobs and those
jobs never end.
```rust
async fn main() {
let (_app_container, jobs) = app::run().await;
// handle the signals
tokio::select! {
_ = tokio::signal::ctrl_c() => {
tracing::info!("Torrust tracker shutting down ...");
// Await for all jobs to shutdown
futures::future::join_all(jobs).await;
tracing::info!("Torrust tracker successfully shutdown.");
}
}
}
```
Now, we can wait for them becuase they listen for the halt signal.
We will implement the shutdown in a different way in a new PR. See
torrust#1405
Instead of listen to the CRTL+c signal the main app will send a "stop"
event to the listeners. The final goal it only the main app listen for
this external signal and it propagates the shutdown in cascade via
normal internal messages or channels.
josecelano
force-pushed
the
1477-fix-shutdown-message-and-improve-it
branch
from
April 29, 2025 15:20
df5c2f6 to
faf8111
Compare
Member
Author
It: - Give a name to all jobs so they can be identify later in logs. - Wait for all jobs to finish when the app receives teh halt signal (CRTL+c) - Only waits for a grace period per job. - Shows a message when a job don't complete in time. This could be improved in the future: - By showing a message every second while we are waiting for a job to finish. - Waiting for all of them in paralell.
josecelano
marked this pull request as ready for review
April 29, 2025 16:46
Member
Author
|
ACK 8f42271 |
Contributor
|
Post-merge note: this pull request requested a review from this account and was closed without one at its final head. A post-merge review will not be done: Only 110 of the 285 executable lines it added remain on the default branch, at their own paths or in the files those paths were later renamed to; the rest has since been rewritten or removed. |
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Fix shutdown message and improve it for HTTP servers (they all use Axum).
Subtasks
CRTL+csignal. Temporary solution until we implement: