From 27bcf647dfdc46c01c9897ddf61f0df96edd2261 Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Sun, 18 May 2025 19:02:43 +0200 Subject: [PATCH] docs: add some docs about TaskExecutor (#16327) --- crates/node/api/src/node.rs | 5 ++++- crates/tasks/src/lib.rs | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/crates/node/api/src/node.rs b/crates/node/api/src/node.rs index d27b908f87..88b0ae5cf5 100644 --- a/crates/node/api/src/node.rs +++ b/crates/node/api/src/node.rs @@ -98,7 +98,10 @@ pub trait FullNodeComponents: FullNodeTypes + Clone + 'static { /// Returns the provider of the node. fn provider(&self) -> &Self::Provider; - /// Returns handle to runtime. + /// Returns an executor handle to spawn tasks. + /// + /// This can be used to spawn critical, blocking tasks or register tasks that should be + /// terminated gracefully. See also [`TaskSpawner`](reth_tasks::TaskSpawner). fn task_executor(&self) -> &TaskExecutor; } diff --git a/crates/tasks/src/lib.rs b/crates/tasks/src/lib.rs index 53ed1d2919..3213f03824 100644 --- a/crates/tasks/src/lib.rs +++ b/crates/tasks/src/lib.rs @@ -179,7 +179,11 @@ pub struct TaskManager { // === impl TaskManager === impl TaskManager { - /// Returns a new [`TaskManager`] over the currently running Runtime. + /// Returns a __new__ [`TaskManager`] over the currently running Runtime. + /// + /// This must be polled for the duration of the program. + /// + /// To obtain the current [`TaskExecutor`] see [`TaskExecutor::current`]. /// /// # Panics ///