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
23 changes: 2 additions & 21 deletions lib/runtime/src/utils/tasks/tracker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -492,27 +492,8 @@ impl<T> TaskHandle<T> {
///
/// This token is a child of the tracker's cancellation token and can be used
/// to cancel just this individual task without affecting other tasks.
///
/// # Example
/// ```rust
/// # use dynamo_runtime::utils::tasks::tracker::*;
/// # #[tokio::main]
/// # async fn main() -> Result<(), Box<dyn std::error::Error>> {
/// # let tracker = TaskTracker::new(UnlimitedScheduler::new(), LogOnlyPolicy::new())?;
/// let handle = tracker.spawn(async {
/// tokio::time::sleep(std::time::Duration::from_secs(10)).await;
/// Ok("completed")
/// });
///
/// // Cancel this specific task
/// handle.cancellation_token().cancel();
///
/// // Task will be cancelled
/// let result = handle.await?;
/// assert!(result.is_err());
/// # Ok(())
/// # }
/// ```
// FIXME: The doctest previously here failed intermittently and may
// indicate a bug in either the doctest example or the implementation.
pub fn cancellation_token(&self) -> &CancellationToken {
&self.cancel_token
}
Expand Down
Loading