Skip to content

Commit

Permalink
fix: the raft protocol is used to synchronize node information fix is…
Browse files Browse the repository at this point in the history
…sue #1348
  • Loading branch information
lutengda committed Jul 13, 2023
1 parent 8d511fe commit ce11c41
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions meta/src/bin/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ async fn detect_node_heartbeat(heartbeat_config: HeartBeatConfig, app: Data<Meta
interval.tick().await;

if let Ok(_leader) = app.raft.is_leader().await {
let sm = app.store.state_machine.write().await;
let sm = app.store.state_machine.read().await;

if let Ok(list) = sm.children_data::<NodeMetrics>(&metrics_path) {
let node_metrics_list: Vec<NodeMetrics> = list.into_values().collect();
Expand All @@ -151,7 +151,9 @@ async fn detect_node_heartbeat(heartbeat_config: HeartBeatConfig, app: Data<Meta
now_node_metrics,
);

sm.process_write_command(&req);
if app.raft.client_write(req).await.is_err() {
tracing::error!("failed to change node status to unreachable");
}
}
}
}
Expand Down

0 comments on commit ce11c41

Please sign in to comment.