Skip to content

Commit

Permalink
Removed comments, and removed expect().
Browse files Browse the repository at this point in the history
  • Loading branch information
fulmicoton committed Feb 19, 2024
1 parent dc77b87 commit c8c363c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
5 changes: 1 addition & 4 deletions chitchat/src/configuration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,7 @@ impl Default for ChitchatConfig {
listen_addr,
seed_nodes: Vec::new(),
failure_detector_config: Default::default(),
// Each heartbeat increments the version, with one heartbeat each second
// 86400 ~ 24h.
// TODO set that to something much lower.
marked_for_deletion_grace_period: Duration::from_secs(86_400),
marked_for_deletion_grace_period: Duration::from_secs(3_600 * 2), // 2h
}
}
}
11 changes: 6 additions & 5 deletions chitchat/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,11 +185,12 @@ impl Chitchat {

let current_live_nodes = self
.live_nodes()
.map(|chitchat_id| {
let node_state = self
.node_state(chitchat_id)
.expect("Node state should exist.");
(chitchat_id.clone(), node_state.max_version())
.flat_map(|chitchat_id| {
if let Some(node_state) = self.node_state(chitchat_id) {
return Some((chitchat_id.clone(), node_state.max_version()));
}
warn!("node state for {chitchat_id:?} is absent");
None
})
.collect::<HashMap<_, _>>();

Expand Down
3 changes: 1 addition & 2 deletions chitchat/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ impl ClusterState {
// We don't want to remove the entire state here: the node could be alive and the
// live watcher panics if the state is missing.
if let Some(node_state) = self.node_states.get_mut(&node_to_reset) {
*node_state = NodeState::new(node_to_reset, self.listeners.clone());
*node_state = NodeState::new(node_to_reset, self.listeners.clone());
}
}

Expand Down Expand Up @@ -1187,7 +1187,6 @@ mod tests {
let mut expected_delta = Delta::default();
expected_delta.add_node_to_reset(node1.clone());
expected_delta.add_node(node1.clone(), Heartbeat(10_000));
// expected_delta.add_kv(&node1, "key_a", "1", 1, false);
expected_delta.add_kv(&node1, "key_b", "2", 2, false);
expected_delta.add_node(node2.clone(), Heartbeat(0));
expected_delta.add_kv(&node2.clone(), "key_c", "3", 2, false);
Expand Down

0 comments on commit c8c363c

Please sign in to comment.