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 <d.csapak@proxmox.com>
This commit is contained in:
Dominik Csapak 2020-09-30 10:45:06 +02:00 committed by Dietmar Maurer
parent ef1b436350
commit df4827f2c0
2 changed files with 2 additions and 1 deletions

View File

@ -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,
_ => {},
}

View File

@ -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);