Skip to content

Commit

Permalink
make revive happy
Browse files Browse the repository at this point in the history
Signed-off-by: Fullstop000 <fullstop1005@gmail.com>
  • Loading branch information
Fullstop000 committed Mar 1, 2020
1 parent b384c79 commit 5c21202
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
3 changes: 1 addition & 2 deletions raft/group.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,8 @@ func (g *Groups) GetMemberInfo(member uint64) *MemberInfo {
func (g *Groups) GetDelegate(peer uint64) uint64 {
if info, ok := g.Indexes[peer]; ok {
return info.Delegate
} else {
return None
}
return None
}

// pickDelegate picks a delegate who has the biggest `match` among the same group of given `to`
Expand Down
2 changes: 1 addition & 1 deletion raft/group_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func TestGroupSystem(t *testing.T) {
}
groups.LeaderGroupID = 1
prs := tracker.MakeProgressTracker(256)
for i := 1; i <= 6; i += 1 {
for i := 1; i <= 6; i++ {
prs.Progress[uint64(i)] = &tracker.Progress{
Match: 99,
Next: 100,
Expand Down
19 changes: 9 additions & 10 deletions raft/raft.go
Original file line number Diff line number Diff line change
Expand Up @@ -1418,17 +1418,16 @@ func (r *raft) handleAppendEntries(m pb.Message) bool {
r.send(toSend)
}
return true
} else {
r.logger.Debugf("%x [logterm: %d, index: %d] rejected MsgApp [logterm: %d, index: %d] from %x",
r.id, r.raftLog.zeroTermOnErrCompacted(r.raftLog.term(m.Index)), m.Index, m.LogTerm, m.Index, m.From)
toSend.Reject = true
toSend.RejectHint = r.raftLog.lastIndex()
if msgFromDelegate(&m) {
toSend.To = m.Delegate
}
r.send(toSend)
return false
}
r.logger.Debugf("%x [logterm: %d, index: %d] rejected MsgApp [logterm: %d, index: %d] from %x",
r.id, r.raftLog.zeroTermOnErrCompacted(r.raftLog.term(m.Index)), m.Index, m.LogTerm, m.Index, m.From)
toSend.Reject = true
toSend.RejectHint = r.raftLog.lastIndex()
if msgFromDelegate(&m) {
toSend.To = m.Delegate
}
r.send(toSend)
return false
}

func (r *raft) handleAppendResponse(pr *tracker.Progress, m pb.Message) (bool, bool) {
Expand Down

0 comments on commit 5c21202

Please sign in to comment.