Skip to content

Commit fc40dc9

Browse files
committed
fix(context): abort once then await in bg; kill zombie tasks, Morty
- Replace duplicate abort with background await to drive completion - Keep drop non-blocking and avoid leaked join handles Signed-off-by: Jessie Frazelle <[email protected]>
1 parent 33b0ff1 commit fc40dc9

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/context.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use std::str::FromStr;
2+
use std::time::Duration;
23

34
use anyhow::{anyhow, Result};
45
use futures::StreamExt;
@@ -668,8 +669,8 @@ impl Drop for ReasoningGuard {
668669
fn drop(&mut self) {
669670
if let Some(handle) = self.0.take() {
670671
handle.abort();
671-
// Abort the task directly without blocking the drop.
672-
handle.abort();
672+
// Ensure the task is polled to completion in the background.
673+
tokio::spawn(async move { let _ = handle.await; });
673674
}
674675
}
675676
}

0 commit comments

Comments
 (0)