Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions rust/src/election.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ pub struct Election<'a> {
follower_fn: Arc<Box<Fn() -> () + Send + Sync + 'a>>,
}

#[derive(Copy, Clone)]
pub enum Handler {
Leader,
Follower,
Expand All @@ -156,11 +157,10 @@ impl<'a> Election<'a> {
let leader_fn = self.leader_fn.clone();
let follower_fn = self.follower_fn.clone();
self.running.store(true, Ordering::Relaxed);
while self.is_running() {
if self.is_running() {
self.lock.lock(|| leader_fn());

follower_fn();
break;
}
}

Expand Down
2 changes: 1 addition & 1 deletion rust/src/lock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use std::time::{Duration};
use requests::{get, put, Error, StatusCode};


pub const DEFAULT_BASE_URI: &'static str = "http://localhost:8080";
pub const DEFAULT_BASE_URI: &str = "http://localhost:8080";



Expand Down