@@ -5,11 +5,8 @@ use std::time::{Duration, Instant};
use parking_lot::{Condvar, Mutex};
use rand::{thread_rng, Rng};
-use crate::utils::retry_rpc;
-use crate::{
- Peer, Raft, RaftState, RequestVoteArgs, RpcClient, State, Term,
- RPC_DEADLINE,
-};
+use crate::utils::{retry_rpc, RPC_DEADLINE};
+use crate::{Peer, Raft, RaftState, RequestVoteArgs, RpcClient, State, Term};
#[derive(Default)]
pub(crate) struct ElectionState {
@@ -4,8 +4,8 @@ use std::time::Duration;
use parking_lot::Mutex;
-use crate::{AppendEntriesArgs, Raft, RaftState, RpcClient, RPC_DEADLINE};
+use crate::{AppendEntriesArgs, Raft, RaftState, RpcClient};
// Command must be
// 0. 'static: Raft<Command> must be 'static, it is moved to another thread.
@@ -269,7 +269,6 @@ where
}
pub(crate) const HEARTBEAT_INTERVAL_MILLIS: u64 = 150;
-const RPC_DEADLINE: Duration = Duration::from_secs(2);
impl<C> Raft<C> {
pub const NO_SNAPSHOT: fn(Index) = |_| {};
@@ -5,10 +5,10 @@ use std::time::Duration;
use crate::index_term::IndexTerm;
use crate::{
AppendEntriesArgs, InstallSnapshotArgs, Peer, Raft, RaftState, RpcClient,
- Term, HEARTBEAT_INTERVAL_MILLIS, RPC_DEADLINE,
+ Term, HEARTBEAT_INTERVAL_MILLIS,
};
#[repr(align(64))]
@@ -28,3 +28,5 @@ where
format!("Timed out after {} retries", max_retry),
))
+
+pub const RPC_DEADLINE: Duration = Duration::from_secs(2);