Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions crates/forge_app/src/hooks/title_generation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,14 @@ impl<S: AgentService> EventHandle<EventData<EndPayload>> for TitleGenerationHand

impl<S> Drop for TitleGenerationHandler<S> {
fn drop(&mut self) {
// Clearing the map drops all `JoinHandle`s (aborting the spawned
// tasks) and `oneshot::Receiver`s. The tasks will observe a closed
// channel on `tx.send()` and exit gracefully.
// Explicitly abort every spawned task before clearing the map.
// Dropping a `JoinHandle` does *not* abort the underlying Tokio task —
// the task would keep running until completion. Calling `.abort()`
// ensures the tasks are cancelled immediately so the runtime can
// shut down cleanly without waiting for pending LLM calls.
for entry in self.title_tasks.iter() {
entry.handle.abort();
}
self.title_tasks.clear();
}
}
Expand Down
Loading