From 8d7681c788f0507f74d11db34e1de942d764418d Mon Sep 17 00:00:00 2001 From: baul Date: Thu, 3 Aug 2023 16:54:04 +0800 Subject: [PATCH 1/2] fix(console): fix task detail view Id, now using remote tokio::task::Id --- tokio-console/src/state/tasks.rs | 4 ++++ tokio-console/src/view/task.rs | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/tokio-console/src/state/tasks.rs b/tokio-console/src/state/tasks.rs index bf9c8a2c0..9f12f3aff 100644 --- a/tokio-console/src/state/tasks.rs +++ b/tokio-console/src/state/tasks.rs @@ -276,6 +276,10 @@ impl Task { self.id } + pub(crate) fn task_id(&self) -> TaskId { + self.task_id.unwrap_or(0) + } + pub(crate) fn span_id(&self) -> SpanId { self.span_id } diff --git a/tokio-console/src/view/task.rs b/tokio-console/src/view/task.rs index 9713eecbb..b07943e24 100644 --- a/tokio-console/src/view/task.rs +++ b/tokio-console/src/view/task.rs @@ -142,7 +142,7 @@ impl TaskView { let mut overview = Vec::with_capacity(8); overview.push(Spans::from(vec![ bold("ID: "), - Span::raw(format!("{} ", task.id())), + Span::raw(format!("{} ", task.task_id())), task.state().render(styles), ])); From 50e5531e00dee92d715e8ce7401023efdeea3362 Mon Sep 17 00:00:00 2001 From: baul Date: Fri, 18 Aug 2023 22:18:25 +0800 Subject: [PATCH 2/2] simplize the fix --- tokio-console/src/state/tasks.rs | 4 ---- tokio-console/src/view/task.rs | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/tokio-console/src/state/tasks.rs b/tokio-console/src/state/tasks.rs index 9f12f3aff..bf9c8a2c0 100644 --- a/tokio-console/src/state/tasks.rs +++ b/tokio-console/src/state/tasks.rs @@ -276,10 +276,6 @@ impl Task { self.id } - pub(crate) fn task_id(&self) -> TaskId { - self.task_id.unwrap_or(0) - } - pub(crate) fn span_id(&self) -> SpanId { self.span_id } diff --git a/tokio-console/src/view/task.rs b/tokio-console/src/view/task.rs index b07943e24..8f3024520 100644 --- a/tokio-console/src/view/task.rs +++ b/tokio-console/src/view/task.rs @@ -142,7 +142,7 @@ impl TaskView { let mut overview = Vec::with_capacity(8); overview.push(Spans::from(vec![ bold("ID: "), - Span::raw(format!("{} ", task.task_id())), + Span::raw(format!("{} ", task.id_str())), task.state().render(styles), ]));