From 399519f6da22bc2bf0c0537f8aa322cc09910691 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Kubern=C3=A1t?= Date: Wed, 7 Jan 2026 12:00:19 +0100 Subject: [PATCH] Always set OnlineStatus::Offline if dir fails We don't really care about the exact reason, and the codes can't be trusted anyway (some brokers return 8). --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/sites.rs | 7 ++----- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0773f0e..45c6780 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -764,7 +764,7 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" [[package]] name = "historyprovider" -version = "2.3.7" +version = "2.4.0" dependencies = [ "async-broadcast", "async-compression", diff --git a/Cargo.toml b/Cargo.toml index ee9e01b..1e6a173 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ name = "historyprovider" description = "historyprovider-rs" license = "MIT" repository = "https://github.com/silicon-heaven/historyprovider-rs" -version = "2.3.7" +version = "2.4.0" edition = "2024" [[bin]] diff --git a/src/sites.rs b/src/sites.rs index 5197e17..0114ad0 100644 --- a/src/sites.rs +++ b/src/sites.rs @@ -10,7 +10,7 @@ use shvclient::clientapi::{CallRpcMethodErrorKind, RpcCall, RpcCallDirExists, Rp use shvclient::clientnode::{METH_DIR, SIG_CHNG}; use shvclient::{ClientCommandSender, ClientEventsReceiver}; use shvproto::{DateTime, RpcValue}; -use shvrpc::rpcmessage::{RpcError, RpcErrorCode}; +use shvrpc::rpcmessage::RpcError; use shvrpc::util::find_longest_path_prefix; use shvrpc::{join_path, RpcMessageMetaTags}; use tokio::time::timeout; @@ -300,10 +300,7 @@ fn online_status_worker( .await; if dir_result.is_ok() { set_online_status(&site, SiteOnlineStatus::Online, &client_commands, &app_state).await; - } else if let Err(err) = dir_result - && let CallRpcMethodErrorKind::RpcError(RpcError { code, .. }) = err.error() - && (*code == RpcErrorCode::MethodCallTimeout.into() || *code == RpcErrorCode::MethodNotFound.into()) - { + } else if let Err(err) = dir_result && matches!(err.error(), CallRpcMethodErrorKind::RpcError(RpcError { .. })) { set_online_status(&site, SiteOnlineStatus::Offline, &client_commands, &app_state).await; } }