Skip to content

Commit

Permalink
Doc: refine doc for error Unreachable
Browse files Browse the repository at this point in the history
  • Loading branch information
drmingdrmer committed Dec 14, 2023
1 parent b073c64 commit c866730
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions openraft/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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}")]
Expand Down

0 comments on commit c866730

Please sign in to comment.