[pdm-devel] [PATCH datacenter-manager 2/9] server: task cache: skip remotes with errors on fetch
Thomas Lamprecht
t.lamprecht at proxmox.com
Mon Jan 20 18:45:55 CET 2025
Am 20.01.25 um 10:29 schrieb Dominik Csapak:
> 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
Even if it's now the case, it's not hard-coded for the future that an
error here will always stem from an unreachable remote; at least
logging that as warning might be good to allow debugging odd things
in a setup.
> + continue;
> + }
> + };
> cache.set_tasks(remote_name.as_str(), tasks.clone(), now);
>
> all_tasks.extend(tasks);
More information about the pdm-devel
mailing list