[pdm-devel] [PATCH datacenter-manager 2/5] remote tasks: implement `refresh_task_cache` for manual task fetching

Lukas Wagner l.wagner at proxmox.com
Tue Dec 16 14:15:15 CET 2025


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 at 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





More information about the pdm-devel mailing list