all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Lukas Wagner <l.wagner@proxmox.com>
To: pdm-devel@lists.proxmox.com
Subject: [pdm-devel] [PATCH datacenter-manager 2/5] remote tasks: implement `refresh_task_cache` for manual task fetching
Date: Tue, 16 Dec 2025 14:15:15 +0100	[thread overview]
Message-ID: <20251216131518.241022-4-l.wagner@proxmox.com> (raw)
In-Reply-To: <20251216131518.241022-1-l.wagner@proxmox.com>

This function can be passed a list of remotes to fetch. Any new
tasks from these remotes will be stored in the task cache.

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
---
 server/src/remote_tasks/refresh_task.rs | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/server/src/remote_tasks/refresh_task.rs b/server/src/remote_tasks/refresh_task.rs
index 0e8ed345..e882c9ec 100644
--- a/server/src/remote_tasks/refresh_task.rs
+++ b/server/src/remote_tasks/refresh_task.rs
@@ -193,6 +193,20 @@ pub async fn handle_timer_tick(task_state: &mut TaskState) -> Result<(), Error>
     Ok(())
 }
 
+/// Manually trigger task collection from a list of remotes.
+pub async fn refresh_taskcache(remotes: Vec<Remote>) -> Result<(), Error> {
+    let cache = super::get_cache()?;
+    let cache_state = cache.read_state();
+
+    let (all_tasks, update_state_for_remote) = fetch_remotes(remotes, Arc::new(cache_state)).await;
+
+    if !all_tasks.is_empty() {
+        update_task_cache(cache, all_tasks, update_state_for_remote, HashMap::new()).await?;
+    }
+
+    Ok(())
+}
+
 /// Initialize the remote task cache with initial archive files, in case there are not
 /// any archive files yet.
 ///
-- 
2.47.3



_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel


  parent reply	other threads:[~2025-12-16 13:14 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-16 13:15 [pdm-devel] [PATCH-SERIES 0/6] manual refresh button for remote task cache Lukas Wagner
2025-12-16 13:15 ` [pdm-devel] [PATCH proxmox-yew-comp 1/1] task list: add support for starting refresh tasks Lukas Wagner
2025-12-16 13:15 ` [pdm-devel] [PATCH datacenter-manager 1/5] remote tasks: move implementation to server crate Lukas Wagner
2025-12-16 13:15 ` Lukas Wagner [this message]
2025-12-16 13:15 ` [pdm-devel] [PATCH datacenter-manager 3/5] api: add /remotes/tasks/refresh Lukas Wagner
2025-12-16 13:15 ` [pdm-devel] [PATCH datacenter-manager 4/5] ui: remote task view: set refresh_task_url property for task viewer Lukas Wagner
2025-12-16 13:15 ` [pdm-devel] [PATCH datacenter-manager 5/5] ui: register task descriptions for some native PDM tasks Lukas Wagner
2025-12-17 14:37 ` [pdm-devel] [PATCH-SERIES 0/6] manual refresh button for remote task cache Lukas Wagner

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=20251216131518.241022-4-l.wagner@proxmox.com \
    --to=l.wagner@proxmox.com \
    --cc=pdm-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal