Skip to content

Commit

Permalink
Merge pull request #2415 from xiaost/fix-leaderid-error
Browse files Browse the repository at this point in the history
raft: fix leaderID error when state changed
  • Loading branch information
otoolep committed Apr 24, 2015
2 parents 2d2c806 + e521ac9 commit 5894f65
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions raft/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -1035,6 +1035,9 @@ func (l *Log) candidateLoop(closing <-chan struct{}) State {
case <-l.terms:
return Follower
case <-elected:
l.lock()
l.leaderID = l.id
l.unlock()
return Leader
case ch := <-l.Clock.AfterElectionTimeout():
close(ch)
Expand Down

0 comments on commit 5894f65

Please sign in to comment.