diff --git a/src/raft.rs b/src/raft.rs index 5d59fb2..f3db6b6 100644 --- a/src/raft.rs +++ b/src/raft.rs @@ -14,9 +14,9 @@ use crate::error::{Error, Result}; use crate::message::{Message, RaftResponse, Status}; use crate::raft_node::{Peer, RaftNode}; use crate::raft_server::RaftServer; -use crate::raft_service::raft_service_client::RaftServiceClient; -use crate::raft_service::Proposal; use crate::raft_service::{ConfChange as RiteraftConfChange, Empty, ResultCode}; +use crate::raft_service::Proposal; +use crate::raft_service::raft_service_client::RaftServiceClient; type DashMap = dashmap::DashMap; @@ -98,7 +98,7 @@ impl Mailbox { proposal, client: leader_client, timeout: Duration::from_millis(1000), - max_retries: 3, + max_retries: 0, }; proposal_sender.send().await } @@ -117,9 +117,9 @@ impl Mailbox { Ok(_) => match timeout(Duration::from_secs(15), rx).await { Ok(Ok(RaftResponse::Response { data })) => Ok(data), Ok(Ok(RaftResponse::WrongLeader { - leader_id, - leader_addr, - })) => { + leader_id, + leader_addr, + })) => { debug!( "this node not is Leader, leader_id: {:?}, leader_addr: {:?}", leader_id, leader_addr diff --git a/src/raft_server.rs b/src/raft_server.rs index 53676f2..cee8066 100644 --- a/src/raft_server.rs +++ b/src/raft_server.rs @@ -6,14 +6,14 @@ use log::{error, info, warn}; use tokio::sync::mpsc; use tokio::sync::oneshot; use tokio::time::timeout; -use tonic::transport::Server; use tonic::{Request, Response, Status}; +use tonic::transport::Server; use crate::message::{Message, RaftResponse}; -use crate::raft_service::raft_service_server::{RaftService, RaftServiceServer}; use crate::raft_service::{ self, ConfChange as RiteraftConfChange, Empty, Message as RiteraftMessage, }; +use crate::raft_service::raft_service_server::{RaftService, RaftServiceServer}; pub struct RaftServer { snd: mpsc::Sender,