raft: correct doc comment
parent
5250784b09
commit
68db18667a
|
@ -869,9 +869,9 @@ func (r *raft) loadState(state pb.HardState) {
|
||||||
r.Vote = state.Vote
|
r.Vote = state.Vote
|
||||||
}
|
}
|
||||||
|
|
||||||
// pastElectionTimeout returns true if r.electionElapsed is greater than the
|
// pastElectionTimeout returns true iff r.electionElapsed is greater
|
||||||
// randomized election timeout in [electiontimeout, 2 * electiontimeout - 1].
|
// than or equal to the randomized election timeout in
|
||||||
// Otherwise, it returns false.
|
// [electiontimeout, 2 * electiontimeout - 1].
|
||||||
func (r *raft) pastElectionTimeout() bool {
|
func (r *raft) pastElectionTimeout() bool {
|
||||||
return r.electionElapsed >= r.randomizedElectionTimeout
|
return r.electionElapsed >= r.randomizedElectionTimeout
|
||||||
}
|
}
|
||||||
|
|
|
@ -747,7 +747,7 @@ func TestCommit(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestIsElectionTimeout(t *testing.T) {
|
func TestPastElectionTimeout(t *testing.T) {
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
elapse int
|
elapse int
|
||||||
wprobability float64
|
wprobability float64
|
||||||
|
@ -776,7 +776,7 @@ func TestIsElectionTimeout(t *testing.T) {
|
||||||
got = math.Floor(got*10+0.5) / 10.0
|
got = math.Floor(got*10+0.5) / 10.0
|
||||||
}
|
}
|
||||||
if got != tt.wprobability {
|
if got != tt.wprobability {
|
||||||
t.Errorf("#%d: possibility = %v, want %v", i, got, tt.wprobability)
|
t.Errorf("#%d: probability = %v, want %v", i, got, tt.wprobability)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue