Skip to content

Commit

Permalink
gofmt + authors
Browse files Browse the repository at this point in the history
  • Loading branch information
Bo Blanton committed Nov 7, 2016
1 parent bc813c4 commit 14fa6ec
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,4 @@ Robert Nix <robert@nicerobot.org>
Nathan Youngman <git@nathany.com>
Charles Law <charles.law@gmail.com>; <claw@conduce.com>
Nathan Davies <nathanjamesdavies@gmail.com>
Bo Blanton <bo.blanton@gmail.com>
8 changes: 4 additions & 4 deletions token.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,21 +203,21 @@ func (t *tokenRing) GetHostForToken(token token) *HostInfo {
if t == nil {
return nil
}

l := len(t.tokens)
// no host tokens, no available hosts
if l == 0{
if l == 0 {
return nil
}

// find the primary replica
ringIndex := sort.Search(
l,
func(i int) bool {
return !t.tokens[i].Less(token)
},
)

if ringIndex == l {
// wrap around to the first in the ring
ringIndex = 0
Expand Down

0 comments on commit 14fa6ec

Please sign in to comment.