Skip to content

Commit acfc34b

Browse files
author
wuhua3
committed
code review
1 parent 7354687 commit acfc34b

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

cluster/clusterSelector.go

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ type DefaultClusterSelector struct {
99
clusterGroup motan.ClusterGroup
1010
defaultSandboxCluster motan.Cluster
1111
defaultGreyCluster motan.Cluster
12-
greyClusterMap map[string]motan.Cluster
1312
}
1413

1514
func (d *DefaultClusterSelector) Init(clusterGroup motan.ClusterGroup) {
@@ -19,11 +18,6 @@ func (d *DefaultClusterSelector) Init(clusterGroup motan.ClusterGroup) {
1918
}
2019
if len(clusterGroup.GetGreyClusters()) > 0 {
2120
d.defaultGreyCluster = clusterGroup.GetGreyClusters()[0]
22-
greyClusterMap := make(map[string]motan.Cluster)
23-
for _, cluster := range clusterGroup.GetGreyClusters() {
24-
greyClusterMap[cluster.GetURL().Group] = cluster
25-
}
26-
d.greyClusterMap = greyClusterMap
2721
}
2822
}
2923

@@ -68,8 +62,8 @@ func (d *DefaultClusterSelector) selectGreyCluster(request motan.Request) motan.
6862
}
6963
routeGroupList := motan.TrimSplit(routeGroup, ",")
7064
for _, group := range routeGroupList {
71-
if cluster, ok := d.greyClusterMap[group]; ok && len(cluster.GetRefers()) > 0 {
72-
return cluster
65+
if group == d.defaultGreyCluster.GetURL().Group {
66+
return d.defaultGreyCluster
7367
}
7468
}
7569
}

0 commit comments

Comments
 (0)