Skip to content

Commit

Permalink
commitment: Adjust for style
Browse files Browse the repository at this point in the history
  • Loading branch information
ongardie committed Mar 21, 2016
1 parent 872c269 commit 5932a08
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions commitment.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,14 @@ func (c *commitment) recalculate() {
if len(c.matchIndexes) == 0 {
return
}
var quorumMatchIndex uint64
{
matched := make([]uint64, 0, len(c.matchIndexes))
for _, idx := range c.matchIndexes {
matched = append(matched, idx)
}
sort.Sort(uint64Slice(matched))
quorumMatchIndex = matched[(len(matched)-1)/2]

matched := make([]uint64, 0, len(c.matchIndexes))
for _, idx := range c.matchIndexes {
matched = append(matched, idx)
}
sort.Sort(uint64Slice(matched))
quorumMatchIndex := matched[(len(matched)-1)/2]

if quorumMatchIndex > c.commitIndex && quorumMatchIndex >= c.startIndex {
c.commitIndex = quorumMatchIndex
asyncNotifyCh(c.commitCh)
Expand Down

0 comments on commit 5932a08

Please sign in to comment.