소스 검색

Merge pull request #718 from Demonthos/handle-removing-a-completed-future

Handle removing a future that does not exist
Jon Kelley 2 년 전
부모
커밋
3393d0487c
2개의 변경된 파일3개의 추가작업 그리고 3개의 파일을 삭제
  1. 2 2
      packages/core/src/scheduler/task.rs
  2. 1 1
      packages/core/src/scheduler/wait.rs

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

@@ -59,9 +59,9 @@ impl Scheduler {
 
     /// Drop the future with the given TaskId
     ///
-    /// This does nto abort the task, so you'll want to wrap it in an aborthandle if that's important to you
+    /// This does not abort the task, so you'll want to wrap it in an aborthandle if that's important to you
     pub fn remove(&self, id: TaskId) {
-        self.tasks.borrow_mut().remove(id.0);
+        self.tasks.borrow_mut().try_remove(id.0);
     }
 }
 

+ 1 - 1
packages/core/src/scheduler/wait.rs

@@ -34,7 +34,7 @@ impl VirtualDom {
             self.scopes[task.scope.0].spawned_tasks.remove(&id);
 
             // Remove it from the scheduler
-            tasks.remove(id.0);
+            tasks.try_remove(id.0);
         }
     }