Skip to content

Commit

Permalink
fix: process_kern_request needs guard to avoid looping
Browse files Browse the repository at this point in the history
  • Loading branch information
akiradeveloper committed Nov 9, 2024
1 parent e6a3c2a commit 2701967
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions sorock/src/process/raft_process/responder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ impl RaftProcess {

rx.await?;
} else {
// Avoid looping.
ensure!(self.driver.self_node_id() != leader_id);
let conn = self.driver.connect(leader_id);
conn.process_kern_request(req).await?;
}
Expand Down Expand Up @@ -80,7 +82,7 @@ impl RaftProcess {

rx.await?
} else {
// This check is to avoid looping.
// Avoid looping.
ensure!(self.driver.self_node_id() != leader_id);
let conn = self.driver.connect(leader_id);
conn.process_user_read_request(req).await?
Expand Down Expand Up @@ -116,9 +118,8 @@ impl RaftProcess {

rx.await?
} else {
// This check is to avoid looping.
// Avoid looping.
ensure!(self.driver.self_node_id() != leader_id);

let conn = self.driver.connect(leader_id);
conn.process_user_write_request(req).await?
};
Expand Down

0 comments on commit 2701967

Please sign in to comment.