Skip to content

Commit 5e972bd

Browse files
committed
fixed scheduler bug
Signed-off-by: Maroon Ayoub <[email protected]>
1 parent d1edfea commit 5e972bd

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

pkg/epp/scheduling/scorer.go

+4-10
Original file line numberDiff line numberDiff line change
@@ -89,21 +89,15 @@ func (mgr *ScorerMgr) ScoreTargets(ctx *types.Context, pods []*types.PodMetrics)
8989

9090
// select pod with maximum score, if more than one with the max score - use random pods from the list
9191
var highestScoreTargets []*types.PodMetrics
92-
// score weights cound be negative
92+
// score weights could be negative
9393
maxScore := 0.0
94-
isFirst := true
9594

9695
for pod, score := range podsTotalScore {
97-
if isFirst {
96+
if score > maxScore {
9897
maxScore = score
9998
highestScoreTargets = []*types.PodMetrics{pod}
100-
} else {
101-
if score > maxScore {
102-
maxScore = score
103-
highestScoreTargets = []*types.PodMetrics{pod}
104-
} else if score == maxScore {
105-
highestScoreTargets = append(highestScoreTargets, pod)
106-
}
99+
} else if score == maxScore {
100+
highestScoreTargets = append(highestScoreTargets, pod)
107101
}
108102
}
109103

0 commit comments

Comments
 (0)