Skip to content

Commit

Permalink
election don't wait forever
Browse files Browse the repository at this point in the history
  • Loading branch information
critical27 committed Oct 29, 2021
1 parent 925a2b1 commit 65c2997
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/kvstore/raftex/RaftPart.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1111,7 +1111,11 @@ bool RaftPart::leaderElection() {
VLOG(2) << idStr_
<< "AskForVoteRequest has been sent to all peers"
", waiting for responses";
futures.wait();
futures.wait(std::chrono::seconds(FLAGS_raft_heartbeat_interval_secs));
if (futures.hasException()) {
LOG(INFO) << idStr_ << "Election timeout";
return false;
}
CHECK(!futures.hasException())
<< "Got exception -- " << futures.result().exception().what().toStdString();
VLOG(2) << idStr_ << "Got AskForVote response back";
Expand Down

0 comments on commit 65c2997

Please sign in to comment.