mirror of
https://github.com/tiqi-group/pydase.git
synced 2025-12-25 15:21:19 +01:00
fix: crashed if stopping a task that didn't run
This commit is contained in:
@@ -125,7 +125,7 @@ class TaskManager(AbstractTaskManager):
|
|||||||
|
|
||||||
def stop_task() -> None:
|
def stop_task() -> None:
|
||||||
# cancel the task
|
# cancel the task
|
||||||
task = self.tasks.pop(name)
|
task = self.tasks.pop(name, None)
|
||||||
if task is not None:
|
if task is not None:
|
||||||
self._loop.call_soon_threadsafe(task["task"].cancel)
|
self._loop.call_soon_threadsafe(task["task"].cancel)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user