From c866730cb2e97940e1244c2e178f012c76b9f756 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E7=82=8E=E6=B3=BC?= Date: Fri, 15 Dec 2023 07:58:42 +0800 Subject: [PATCH] Doc: refine doc for error Unreachable --- openraft/src/error.rs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/openraft/src/error.rs b/openraft/src/error.rs index 244294154..2f015b2bb 100644 --- a/openraft/src/error.rs +++ b/openraft/src/error.rs @@ -344,11 +344,16 @@ impl NetworkError { } } -/// Error that indicates a node is unreachable and should not retry sending anything to it -/// immediately. +/// Error indicating a node is unreachable. Retries should be delayed. +/// +/// This error suggests that immediate retries are not advisable when a node is not reachable. +/// Upon encountering this error, Openraft will invoke [`backoff()`] to implement a delay before +/// attempting to resend any information. +/// +/// This error is similar to [`NetworkError`] but with a key distinction: `Unreachable` advises a +/// backoff period, whereas with [`NetworkError`], Openraft may attempt an immediate retry. /// -/// It is similar to [`NetworkError`] but indicating a backoff. -/// When a [`NetworkError`] is returned, Openraft will retry immediately. +/// [`backoff()`]: crate::network::RaftNetwork::backoff #[derive(Debug, Clone, PartialEq, Eq, thiserror::Error)] #[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize), serde(bound = ""))] #[error("Unreachable node: {source}")]