From f6dd9a923cb4e0827616115379a48f521451f8e4 Mon Sep 17 00:00:00 2001 From: Ricardo Dias Date: Mon, 7 Oct 2019 10:39:10 +0100 Subject: [PATCH] mgr/dashboard: tasks: only unblock controller thread after TaskManager thread Fixes: https://tracker.ceph.com/issues/42187 Signed-off-by: Ricardo Dias --- src/pybind/mgr/dashboard/tools.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/pybind/mgr/dashboard/tools.py b/src/pybind/mgr/dashboard/tools.py index 804564512c24b..785f025f370a4 100644 --- a/src/pybind/mgr/dashboard/tools.py +++ b/src/pybind/mgr/dashboard/tools.py @@ -585,6 +585,7 @@ class Task(object): return str(self) def _run(self): + NotificationQueue.register(self._handle_task_finished, 'cd_task_finished', 100) with self.lock: assert not self.running self.executor.init(self) @@ -610,10 +611,14 @@ class Task(object): if not self.exception: self.set_progress(100, True) NotificationQueue.new_notification('cd_task_finished', self) - self.event.set() logger.debug("TK: execution of %s finished in: %s s", self, self.duration) + def _handle_task_finished(self, task): + if self == task: + NotificationQueue.deregister(self._handle_task_finished) + self.event.set() + def wait(self, timeout=None): with self.lock: assert self.running, "wait cannot be called before _run" -- 2.39.5