浏览代码

fix panic when waking future on shutdown

Evan Almloff 2 年之前
父节点
当前提交
226bd3a6e1
共有 1 个文件被更改,包括 3 次插入3 次删除
  1. 3 3
      packages/core/src/scheduler/task.rs

+ 3 - 3
packages/core/src/scheduler/task.rs

@@ -72,9 +72,9 @@ pub struct LocalTaskHandle {
 
 impl ArcWake for LocalTaskHandle {
     fn wake_by_ref(arc_self: &Arc<Self>) {
-        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));
     }
 }