Skip to content
This repository has been archived by the owner on Sep 6, 2018. It is now read-only.

Commit

Permalink
Merge pull request #165 from philips/add-comment-on-nop-command
Browse files Browse the repository at this point in the history
docs(server): add a comment explaining the NOPCommand
  • Loading branch information
xiang90 committed Jan 23, 2014
2 parents 3a5d909 + 5b5fc70 commit 0a20921
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions server.go
Expand Up @@ -763,6 +763,10 @@ func (s *server) leaderLoop() {
peer.startHeartbeat()
}

// Commit a NOP after the server becomes leader. From the Raft paper:
// "Upon election: send initial empty AppendEntries RPCs (heartbeat) to
// each server; repeat during idle periods to prevent election timeouts
// (§5.2)". The heartbeats started above do the "idle" period work.
go s.Do(NOPCommand{})

// Begin to collect response from followers
Expand Down

0 comments on commit 0a20921

Please sign in to comment.