Skip to content

Commit

Permalink
Reformat Codes
Browse files Browse the repository at this point in the history
  • Loading branch information
rmqtt committed Jun 4, 2022
1 parent 21a70ac commit 8e9ebb5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions src/raft.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<K, V> = dashmap::DashMap<K, V, ahash::RandomState>;

Expand Down Expand Up @@ -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
}
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/raft_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Message>,
Expand Down

0 comments on commit 8e9ebb5

Please sign in to comment.