Browse Source

raft: use log.lastIndex()

Xiang Li 11 years ago
parent
commit
a06729a96a
1 changed files with 1 additions and 1 deletions
  1. 1 1
      raft/log.go

+ 1 - 1
raft/log.go

@@ -30,7 +30,7 @@ func (l *log) maybeAppend(index, logTerm, commit int, ents ...Entry) bool {
 
 func (l *log) append(after int, ents ...Entry) int {
 	l.ents = append(l.ents[:after+1], ents...)
-	return len(l.ents) - 1
+	return l.lastIndex()
 }
 
 func (l *log) lastIndex() int {