Skip to content

Commit

Permalink
ensure timely shutdown
Browse files Browse the repository at this point in the history
  • Loading branch information
JssDWt committed Feb 3, 2025
1 parent 80dec25 commit 4e1d951
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion swapd/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,6 @@ where
let token = CancellationToken::new();
let signal_token = token.clone();
let tracker = TaskTracker::new();

tokio::spawn(async move {
match signal::ctrl_c().await {
Ok(()) => {}
Expand Down Expand Up @@ -484,6 +483,11 @@ where
}

info!("swapd started");

// Ensure the tracker completes when all tasks have completed.
tracker.close();

// Wait for all background tasks to complete.
tracker.wait().await;
info!("shutdown complete");
Ok(())
Expand Down

0 comments on commit 4e1d951

Please sign in to comment.