Browse Source

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

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

Signed-off-by: Ryan Russell <git@ryanrussell.org>
pull/3624/merge
Ryan Russell 2 years ago
committed by GitHub
parent
commit
c202d4c1b0
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      weed/server/master_grpc_server_cluster.go

8
weed/server/master_grpc_server_cluster.go

@ -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

Loading…
Cancel
Save