public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Christian Ebner <c.ebner@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [PATCH proxmox-backup v2] api: node: fix task view by returning optional endtime in tasks status
Date: Mon,  4 May 2026 17:43:46 +0200	[thread overview]
Message-ID: <20260504154346.901478-1-c.ebner@proxmox.com> (raw)

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





             reply	other threads:[~2026-05-04 15:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-04 15:43 Christian Ebner [this message]
2026-05-04 18:03 ` applied: [PATCH proxmox-backup v2] api: node: fix task view by returning optional endtime in tasks status Thomas Lamprecht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260504154346.901478-1-c.ebner@proxmox.com \
    --to=c.ebner@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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