Skip to content

Commit

Permalink
clippy errors
Browse files Browse the repository at this point in the history
  • Loading branch information
vaibhawvipul committed Aug 2, 2024
1 parent 857e899 commit f98ebbc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
4 changes: 2 additions & 2 deletions examples/simulate_node_failure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
// License: MIT License

use raft_rs::log::get_logger;
use raft_rs::server::{Server, ServerConfig};
use rand::Rng;
use slog::{info, warn};
use std::collections::HashMap;
use rand::Rng;
use tokio::time::{sleep, Duration};
use raft_rs::server::{Server, ServerConfig};

#[tokio::main]
async fn main() {
Expand Down
15 changes: 8 additions & 7 deletions src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,10 @@ impl Server {
.clone()
})
.collect();
info!(self.log, "Starting election, id: {}, term: {}", self.id, self.state.current_term);
info!(
self.log,
"Starting election, id: {}, term: {}", self.id, self.state.current_term
);
let _ = self.network_manager.broadcast(&data, addresses).await;

loop {
Expand Down Expand Up @@ -743,13 +746,11 @@ impl Server {
self.state.state = RaftState::Follower;
self.state.current_term = term;
}
} else if self.id != self.config.default_leader.unwrap() {
self.state.state = RaftState::Follower;
self.state.current_term = term;
} else {
if self.id != self.config.default_leader.unwrap() {
self.state.state = RaftState::Follower;
self.state.current_term = term;
} else {
self.state.state = RaftState::Leader;
}
self.state.state = RaftState::Leader;
}
}

Expand Down

0 comments on commit f98ebbc

Please sign in to comment.