Fixed handling of multiple nodes in region-aware routing

This commit is contained in:
David Zhao
2021-10-10 22:25:29 -07:00
parent 822f8c3944
commit 575b99840a
3 changed files with 22 additions and 2 deletions
+1 -2
View File
@@ -64,12 +64,11 @@ func (s *RegionAwareSelector) SelectNode(nodes []*livekit.Node, room *livekit.Ro
// find nodes nearest to current region
var nearestNodes []*livekit.Node
nearestRegion := s.CurrentRegion
nearestRegion := ""
minDist := math.MaxFloat64
for _, node := range nodes {
if node.Region == nearestRegion {
nearestNodes = append(nearestNodes, node)
minDist = 0
continue
}
if dist, ok := s.regionDistances[node.Region]; ok {