[pdm-devel] [PATCH datacenter-manager 2/9] server: task cache: skip remotes with errors on fetch

Dominik Csapak d.csapak at proxmox.com
Mon Jan 20 10:29:59 CET 2025


instead of failing the whole cache retrieval, just skip the remote.

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 server/src/task_cache.rs | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/server/src/task_cache.rs b/server/src/task_cache.rs
index 3ef24b1..210aa5f 100644
--- a/server/src/task_cache.rs
+++ b/server/src/task_cache.rs
@@ -42,7 +42,13 @@ pub async fn get_tasks(max_age: i64) -> Result<Vec<TaskListItem>, Error> {
             // Data in cache is recent enough and has not been invalidated.
             all_tasks.extend(tasks);
         } else {
-            let tasks = fetch_tasks(remote).await?;
+            let tasks = match fetch_tasks(remote).await {
+                Ok(tasks) => tasks,
+                Err(err) => {
+                    // ignore errors for not reachable remotes
+                    continue;
+                }
+            };
             cache.set_tasks(remote_name.as_str(), tasks.clone(), now);
 
             all_tasks.extend(tasks);
-- 
2.39.5





More information about the pdm-devel mailing list