refactor(master_grpc_server_cluster): seletedSet -> selectedSet (#3693)

Signed-off-by: Ryan Russell <git@ryanrussell.org>

Signed-off-by: Ryan Russell <git@ryanrussell.org>
This commit is contained in:
Ryan Russell 2022-09-15 05:12:13 -05:00 committed by GitHub
parent f9e3e7d1c4
commit c202d4c1b0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -57,15 +57,15 @@ func limitTo(nodes []*cluster.ClusterNode, limit int32) (selected []*cluster.Clu
if limit <= 0 || len(nodes) < int(limit) { if limit <= 0 || len(nodes) < int(limit) {
return nodes return nodes
} }
seletedSet := make(map[pb.ServerAddress]*cluster.ClusterNode) selectedSet := make(map[pb.ServerAddress]*cluster.ClusterNode)
for i := 0; i < int(limit)*3; i++ { for i := 0; i < int(limit)*3; i++ {
x := rand.Intn(len(nodes)) x := rand.Intn(len(nodes))
if _, found := seletedSet[nodes[x].Address]; found { if _, found := selectedSet[nodes[x].Address]; found {
continue continue
} }
seletedSet[nodes[x].Address] = nodes[x] selectedSet[nodes[x].Address] = nodes[x]
} }
for _, node := range seletedSet { for _, node := range selectedSet {
selected = append(selected, node) selected = append(selected, node)
} }
return return