fix same dc and other dc

This commit is contained in:
Chris Lu 2021-11-16 09:14:01 -08:00
parent a0ef6e3611
commit 3d87aa767d

View file

@ -73,9 +73,9 @@ func (vc *vidMap) LookupVolumeServerUrl(vid string) (serverUrls []string, err er
var sameDcServers, otherDcServers []string var sameDcServers, otherDcServers []string
for _, loc := range locations { for _, loc := range locations {
if vc.DataCenter == "" || loc.DataCenter == "" || vc.DataCenter != loc.DataCenter { if vc.DataCenter == "" || loc.DataCenter == "" || vc.DataCenter != loc.DataCenter {
sameDcServers = append(sameDcServers, loc.Url)
} else {
otherDcServers = append(otherDcServers, loc.Url) otherDcServers = append(otherDcServers, loc.Url)
} else {
sameDcServers = append(sameDcServers, loc.Url)
} }
} }
rand.Shuffle(len(sameDcServers), func(i, j int) { rand.Shuffle(len(sameDcServers), func(i, j int) {