diff --git a/crates/node/builder/src/launch/engine.rs b/crates/node/builder/src/launch/engine.rs index afad49e73e..f322590c70 100644 --- a/crates/node/builder/src/launch/engine.rs +++ b/crates/node/builder/src/launch/engine.rs @@ -372,7 +372,7 @@ impl EngineNodeLauncher { ); } } - _ = &mut on_graceful_shutdown => { + _guard = &mut on_graceful_shutdown => { // Shutdown signal received. // Send Terminate so the engine OS thread can exit cleanly before we // drop the orchestrator. @@ -390,7 +390,7 @@ impl EngineNodeLauncher { let _ = exit.send(res); }; ctx.task_executor() - .spawn_critical_with_shutdown_signal("consensus engine", consensus_engine); + .spawn_critical_with_graceful_shutdown_signal("consensus engine", consensus_engine); let engine_events_for_ethstats = engine_events.new_listener(); diff --git a/crates/tasks/src/runtime.rs b/crates/tasks/src/runtime.rs index 2950fe3064..5da2eb454b 100644 --- a/crates/tasks/src/runtime.rs +++ b/crates/tasks/src/runtime.rs @@ -573,35 +573,6 @@ impl Runtime { self.spawn_critical_as(name, fut, TaskKind::Blocking) } - /// This spawns a critical task onto the runtime. - /// - /// If this task panics, the [`TaskManager`] is notified. - pub fn spawn_critical_with_shutdown_signal( - &self, - name: &'static str, - f: impl FnOnce(Shutdown) -> F, - ) -> JoinHandle<()> - where - F: Future + Send + 'static, - { - let panicked_tasks_tx = self.0.task_events_tx.clone(); - let on_shutdown = self.0.on_shutdown.clone(); - let fut = f(on_shutdown); - - // wrap the task in catch unwind - let task = std::panic::AssertUnwindSafe(fut) - .catch_unwind() - .map_err(move |error| { - let task_error = PanickedTaskError::new(name, error); - error!("{task_error}"); - let _ = panicked_tasks_tx.send(TaskEvent::Panic(task_error)); - }) - .map(drop) - .in_current_span(); - - self.0.handle.spawn(task) - } - /// This spawns a critical task onto the runtime. /// /// If this task panics, the [`TaskManager`] is notified.