From e14c525449743cd63f86964663af9fa8c3a78a6d Mon Sep 17 00:00:00 2001 From: Peter Holloway Date: Thu, 29 Oct 2026 12:13:11 +0000 Subject: [PATCH] fix: Ignore missing task ID when removing from _pending As the _current task is not cleared until it is overwritten when the next task starts and the killsignal handling goes through the same task handling logic as 'normal' tasks, the task would be removed from the pending list twice, failing the second time around. Given the worker is shutting down at that point it doesn't matter if the exception is raised, it's just an annoyance to have the false-positive error logged. There is more work to be done in this area around when the current task is cleared and when it is removed from pending but should be a new change in its own right. --- src/blueapi/worker/task_worker.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/blueapi/worker/task_worker.py b/src/blueapi/worker/task_worker.py index 9da569f0c..219a1c1ca 100644 --- a/src/blueapi/worker/task_worker.py +++ b/src/blueapi/worker/task_worker.py @@ -475,7 +475,7 @@ def process_task(): if self._current is not None: self._current.is_complete = True - self._pending_tasks.pop(self._current.task_id) + self._pending_tasks.pop(self._current.task_id, None) self._completed_tasks[self._current.task_id] = self._current self._report_status() self._errors.clear()