Skip to content

Commit

Permalink
Export task-center task names to tokio
Browse files Browse the repository at this point in the history
  • Loading branch information
AhmedSoliman committed May 1, 2024
1 parent ec3b7bb commit 0dd5cd1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion crates/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ static_assertions = { workspace = true }
strum = { workspace = true }
strum_macros = { workspace = true }
thiserror = { workspace = true }
tokio = { workspace = true }
tokio = { workspace = true, features = ["tracing" ] }
tokio-stream = { workspace = true }
tokio-util = { workspace = true }
tracing = { workspace = true }
Expand Down
8 changes: 6 additions & 2 deletions crates/core/src/task_center.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,15 +225,19 @@ impl TaskCenter {
let mut handle_mut = task.join_handle.lock().unwrap();

let task_cloned = Arc::clone(&task);
let join_handle = inner.default_runtime_handle.spawn(wrapper(
let tokio_task = tokio::task::Builder::new().name(name);
let fut = wrapper(
self.clone(),
id,
kind,
task_cloned,
cancel,
metadata,
future,
));
);
let join_handle = tokio_task
.spawn_on(fut, &inner.default_runtime_handle)
.expect("default runtime can spawn tasks");
*handle_mut = Some(join_handle);
drop(handle_mut);
let kind_str: &'static str = kind.into();
Expand Down

0 comments on commit 0dd5cd1

Please sign in to comment.