Browse Source

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

Xiang Li 11 years ago
parent
commit
0060c0749a
1 changed files with 1 additions and 1 deletions
  1. 1 1
      raft/node.go

+ 1 - 1
raft/node.go

@@ -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