fix cross process task listing
it does not make sense to check if the worker is running if we already have an endtime and state our 'worker_is_active_local' heuristic returns true for non process-local tasks, so we got 'running' for all tasks that were not started by 'our' pid and were still running Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
parent
22231524e2
commit
fae11693f0
@ -270,14 +270,10 @@ fn update_active_workers(new_upid: Option<&UPID>) -> Result<Vec<TaskListInfo>, E
|
|||||||
let line = line?;
|
let line = line?;
|
||||||
match parse_worker_status_line(&line) {
|
match parse_worker_status_line(&line) {
|
||||||
Err(err) => bail!("unable to parse active worker status '{}' - {}", line, err),
|
Err(err) => bail!("unable to parse active worker status '{}' - {}", line, err),
|
||||||
Ok((upid_str, upid, state)) => {
|
Ok((upid_str, upid, state)) => match state {
|
||||||
|
None if worker_is_active_local(&upid) => {
|
||||||
let running = worker_is_active_local(&upid);
|
|
||||||
|
|
||||||
if running {
|
|
||||||
active_list.push(TaskListInfo { upid, upid_str, state: None });
|
active_list.push(TaskListInfo { upid, upid_str, state: None });
|
||||||
} else {
|
},
|
||||||
match state {
|
|
||||||
None => {
|
None => {
|
||||||
println!("Detected stopped UPID {}", upid_str);
|
println!("Detected stopped UPID {}", upid_str);
|
||||||
let status = upid_read_status(&upid)
|
let status = upid_read_status(&upid)
|
||||||
@ -285,7 +281,7 @@ fn update_active_workers(new_upid: Option<&UPID>) -> Result<Vec<TaskListInfo>, E
|
|||||||
finish_list.push(TaskListInfo {
|
finish_list.push(TaskListInfo {
|
||||||
upid, upid_str, state: Some((Local::now().timestamp(), status))
|
upid, upid_str, state: Some((Local::now().timestamp(), status))
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
Some((endtime, status)) => {
|
Some((endtime, status)) => {
|
||||||
finish_list.push(TaskListInfo {
|
finish_list.push(TaskListInfo {
|
||||||
upid, upid_str, state: Some((endtime, status))
|
upid, upid_str, state: Some((endtime, status))
|
||||||
@ -295,8 +291,6 @@ fn update_active_workers(new_upid: Option<&UPID>) -> Result<Vec<TaskListInfo>, E
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if let Some(upid) = new_upid {
|
if let Some(upid) = new_upid {
|
||||||
active_list.push(TaskListInfo { upid: upid.clone(), upid_str: upid.to_string(), state: None });
|
active_list.push(TaskListInfo { upid: upid.clone(), upid_str: upid.to_string(), state: None });
|
||||||
|
Loading…
Reference in New Issue
Block a user