Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions pkg/plugins/gateway/algorithms/least_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,11 @@ func selectTargetPodWithLeastRequestCount(cache cache.Cache, readyPods []*v1.Pod
minCount := math.MaxInt32
podRequestCount := getRequestCounts(cache, readyPods)
klog.V(4).InfoS("selectTargetPodWithLeastRequestCount", "podRequestCount", podRequestCount)
for _, totalReq := range podRequestCount {
if totalReq <= minCount {
minCount = totalReq
}
}
for podname, totalReq := range podRequestCount {
if totalReq == minCount {
if totalReq < minCount {
minCount = totalReq
targetPods = []string{podname}
} else if totalReq == minCount {
targetPods = append(targetPods, podname)
}
}
Expand Down