Skip to content

Commit

Permalink
enhancemanet: reduce calculation calls
Browse files Browse the repository at this point in the history
Signed-off-by: lowang_bh <lhui_wang@163.com>
  • Loading branch information
lowang-bh committed Apr 18, 2023
1 parent 1f0e718 commit eaba170
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pkg/scheduler/util/utils.go
Expand Up @@ -67,12 +67,12 @@ func GetEarliestPodStartTime(victims *extenderv1.Victims) *metav1.Time {
maxPriority := corev1helpers.PodPriority(victims.Pods[0])

for _, pod := range victims.Pods {
if corev1helpers.PodPriority(pod) == maxPriority {
if GetPodStartTime(pod).Before(earliestPodStartTime) {
earliestPodStartTime = GetPodStartTime(pod)
if podPriority := corev1helpers.PodPriority(pod); podPriority == maxPriority {
if podStartTime := GetPodStartTime(pod); podStartTime.Before(earliestPodStartTime) {
earliestPodStartTime = podStartTime
}
} else if corev1helpers.PodPriority(pod) > maxPriority {
maxPriority = corev1helpers.PodPriority(pod)
} else if podPriority > maxPriority {
maxPriority = podPriority
earliestPodStartTime = GetPodStartTime(pod)
}
}
Expand Down

0 comments on commit eaba170

Please sign in to comment.