From 226bd3a6e186a225932add48d71609d666024de5 Mon Sep 17 00:00:00 2001 From: Evan Almloff Date: Mon, 13 Mar 2023 15:50:05 -0500 Subject: [PATCH] fix panic when waking future on shutdown --- packages/core/src/scheduler/task.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/core/src/scheduler/task.rs b/packages/core/src/scheduler/task.rs index 997953f8e..fc668b364 100644 --- a/packages/core/src/scheduler/task.rs +++ b/packages/core/src/scheduler/task.rs @@ -72,9 +72,9 @@ pub struct LocalTaskHandle { impl ArcWake for LocalTaskHandle { fn wake_by_ref(arc_self: &Arc) { - arc_self + // This can fail if the scheduler has been dropped while the application is shutting down + let _ = arc_self .tx - .unbounded_send(SchedulerMsg::TaskNotified(arc_self.id)) - .unwrap(); + .unbounded_send(SchedulerMsg::TaskNotified(arc_self.id)); } }