server/worker_task: let upid_read_status also return the endtime

the endtime should be the timestamp of the last log line
or if there is no log at all, the starttime

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
Dominik Csapak
2020-08-13 10:29:14 +02:00
committed by Dietmar Maurer
parent 4c116bafb8
commit ae197dda23
2 changed files with 19 additions and 10 deletions

View File

@ -105,7 +105,7 @@ async fn get_task_status(
if crate::server::worker_is_active(&upid).await? {
result["status"] = Value::from("running");
} else {
let exitstatus = crate::server::upid_read_status(&upid).unwrap_or(TaskState::Unknown);
let (_, exitstatus) = crate::server::upid_read_status(&upid).unwrap_or((0, TaskState::Unknown));
result["status"] = Value::from("stopped");
result["exitstatus"] = Value::from(exitstatus.to_string());
};