Skip to content

Commit

Permalink
remove unnecessary token sorting
Browse files Browse the repository at this point in the history
Signed-off-by: Owen Diehl <[email protected]>
  • Loading branch information
owen-d committed Feb 15, 2024
1 parent 6434df7 commit 70bede9
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions pkg/bloomutils/ring.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,8 @@ func (i InstancesWithTokenRange) Contains(token uint32) bool {
// token.
func GetInstanceWithTokenRange(id string, instances []ring.InstanceDesc) (v1.FingerprintBounds, error) {

// Sorting the tokens of the instances would not be necessary if there is
// only a single token per instances, however, since we only assume one
// token, but don't enforce one token, we keep the sorting.
for _, inst := range instances {
sort.Slice(inst.Tokens, func(i, j int) bool {
return inst.Tokens[i] < inst.Tokens[j]
})
}

// Sort instances
// Sort instances -- they may not be sorted
// because they're usually accessed by looking up the tokens (which are sorted)
sort.Slice(instances, func(i, j int) bool {
return instances[i].Tokens[0] < instances[j].Tokens[0]
})
Expand Down

0 comments on commit 70bede9

Please sign in to comment.