diff --git a/crates/katana/tasks/src/manager.rs b/crates/katana/tasks/src/manager.rs index e7095786c5..42681079d1 100644 --- a/crates/katana/tasks/src/manager.rs +++ b/crates/katana/tasks/src/manager.rs @@ -52,7 +52,12 @@ impl TaskManager { /// /// No task can be spawned on the manager after this method is called. pub async fn shutdown(self) { + if !self.on_cancel.is_cancelled() { + self.on_cancel.cancel(); + } + self.wait_for_shutdown().await; + // need to close the tracker first before waiting let _ = self.tracker.close(); self.tracker.wait().await;