From df4827f2c04738ee98ee023988c9e971d1337689 Mon Sep 17 00:00:00 2001 From: Dominik Csapak Date: Wed, 30 Sep 2020 10:45:06 +0200 Subject: [PATCH] tasks: improve behaviour on upgrade when upgrading from a version where we stored all tasks in the 'active' file, we did not completly account for finished tasks still there we should update the file when encountering any finished task in 'active' as well as filter them out on the api call (if they get through) Signed-off-by: Dominik Csapak --- src/api2/node/tasks.rs | 1 + src/server/worker_task.rs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/api2/node/tasks.rs b/src/api2/node/tasks.rs index 80384ea8..1440859b 100644 --- a/src/api2/node/tasks.rs +++ b/src/api2/node/tasks.rs @@ -352,6 +352,7 @@ pub fn list_tasks( } match info.state { + Some(_) if running => return None, Some(crate::server::TaskState::OK { .. }) if errors => return None, _ => {}, } diff --git a/src/server/worker_task.rs b/src/server/worker_task.rs index be689c7f..b2e2abd5 100644 --- a/src/server/worker_task.rs +++ b/src/server/worker_task.rs @@ -539,7 +539,7 @@ impl TaskListInfoIterator { let needs_update = active_list .iter() - .any(|info| info.state.is_none() && !worker_is_active_local(&info.upid)); + .any(|info| info.state.is_some() || !worker_is_active_local(&info.upid)); if needs_update { drop(lock);