raft: prev should be set only when we sucessfully send out rd to the channel

This commit is contained in:
Xiang Li 2014-09-08 21:12:02 -07:00
parent 57ea72d3c4
commit 0060c0749a

View File

@ -106,7 +106,6 @@ func (n *Node) run(r *raft) {
if rd.containsUpdates(prev) {
readyc = n.readyc
prev = rd
} else {
readyc = nil
}
@ -122,6 +121,7 @@ func (n *Node) run(r *raft) {
case readyc <- rd:
r.raftLog.resetNextEnts()
r.raftLog.resetUnstable()
prev = rd
r.msgs = nil
case <-n.done:
return