From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id D1F251FF136 for ; Mon, 04 May 2026 17:44:02 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 9278B27A0F; Mon, 4 May 2026 17:44:01 +0200 (CEST) From: Christian Ebner 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 Message-ID: <20260504154346.901478-1-c.ebner@proxmox.com> X-Mailer: git-send-email 2.47.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1777909331394 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.070 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: MGMR3PEYO33NOQIXACQNQ6V5NYIMFKBE X-Message-ID-Hash: MGMR3PEYO33NOQIXACQNQ6V5NYIMFKBE X-MailFrom: c.ebner@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox Backup Server development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: 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 --- 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: ', 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