public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [PATCH proxmox-backup v2] api: node: fix task view by returning optional endtime in tasks status
@ 2026-05-04 15:43 Christian Ebner
  2026-05-04 18:03 ` applied: " Thomas Lamprecht
  0 siblings, 1 reply; 2+ messages in thread
From: Christian Ebner @ 2026-05-04 15:43 UTC (permalink / raw)
  To: pbs-devel

With the intention to correctly show the task end time without
relying on further API calls or workarounds to gather it.

Whenever the task is considered finished, return the endtime
according to the parsed TaskState.

Same issue as tackled by commit e8552dae3 ("ui: sync/verify view:
show correct duration in task log window"), but since commit
7431c0766 ("window: TaskViewer: derive endtime from polled status
when not provided") in proxmox-widget-toolkit we can rely on the
task viewer to get the endtime by itself

Fixes: https://forum.proxmox.com/threads/183157/
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
---
Changes since version 1 (thanks @Dominik & @Thomas):
- Drop no longer needed ui patch
- Only return endtime if non-zero (= unknown)

 src/api2/node/tasks.rs | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/api2/node/tasks.rs b/src/api2/node/tasks.rs
index fe619a08e..2ecfb2441 100644
--- a/src/api2/node/tasks.rs
+++ b/src/api2/node/tasks.rs
@@ -255,6 +255,11 @@ fn into_task_list_item(info: proxmox_rest_server::TaskListInfo) -> pbs_api_types
                 optional: true,
                 description: "'OK', 'Error: <msg>', or 'unknown'.",
             },
+            endtime: {
+                type: i64,
+                description: "The task end time (Epoch)",
+                optional: true,
+            },
         },
     },
     access: {
@@ -292,6 +297,10 @@ async fn get_task_status(param: Value, rpcenv: &mut dyn RpcEnvironment) -> Resul
         let exitstatus = upid_read_status(&upid).unwrap_or(TaskState::Unknown { endtime: 0 });
         result["status"] = Value::from("stopped");
         result["exitstatus"] = Value::from(exitstatus.to_string());
+        let endtime = exitstatus.endtime();
+        if endtime > 0 {
+            result["endtime"] = Value::from(endtime);
+        }
     };
 
     Ok(result)
-- 
2.47.3





^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-05-04 18:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-04 15:43 [PATCH proxmox-backup v2] api: node: fix task view by returning optional endtime in tasks status Christian Ebner
2026-05-04 18:03 ` applied: " Thomas Lamprecht

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal