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:
parent
ef1b436350
commit
df4827f2c0
|
@ -352,6 +352,7 @@ pub fn list_tasks(
|
||||||
}
|
}
|
||||||
|
|
||||||
match info.state {
|
match info.state {
|
||||||
|
Some(_) if running => return None,
|
||||||
Some(crate::server::TaskState::OK { .. }) if errors => return None,
|
Some(crate::server::TaskState::OK { .. }) if errors => return None,
|
||||||
_ => {},
|
_ => {},
|
||||||
}
|
}
|
||||||
|
|
|
@ -539,7 +539,7 @@ impl TaskListInfoIterator {
|
||||||
|
|
||||||
let needs_update = active_list
|
let needs_update = active_list
|
||||||
.iter()
|
.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 {
|
if needs_update {
|
||||||
drop(lock);
|
drop(lock);
|
||||||
|
|
Loading…
Reference in New Issue