Skip to content

Commit 6624541

Browse files
committed
cleanup: remove isUnschedPodUpdateIncluded variable
1 parent 4f853fc commit 6624541

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

pkg/scheduler/eventhandlers.go

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -142,17 +142,12 @@ func (sched *Scheduler) updatePodInSchedulingQueue(oldObj, newObj interface{}) {
142142
return
143143
}
144144

145-
isUnschedPodUpdateIncluded := false
145+
defer metrics.EventHandlingLatency.WithLabelValues(framework.UnscheduledPodUpdate.Label).Observe(metrics.SinceInSeconds(start))
146146
for _, evt := range framework.PodSchedulingPropertiesChange(newPod, oldPod) {
147-
defer metrics.EventHandlingLatency.WithLabelValues(evt.Label).Observe(metrics.SinceInSeconds(start))
148-
if evt.Label == framework.UnscheduledPodUpdate.Label {
149-
isUnschedPodUpdateIncluded = true
147+
if evt.Label != framework.UnscheduledPodUpdate.Label {
148+
defer metrics.EventHandlingLatency.WithLabelValues(evt.Label).Observe(metrics.SinceInSeconds(start))
150149
}
151150
}
152-
if !isUnschedPodUpdateIncluded {
153-
// make sure we always record the latency with UnscheduledPodUpdate label.
154-
defer metrics.EventHandlingLatency.WithLabelValues(framework.UnscheduledPodUpdate.Label).Observe(metrics.SinceInSeconds(start))
155-
}
156151

157152
isAssumed, err := sched.Cache.IsAssumedPod(newPod)
158153
if err != nil {

0 commit comments

Comments
 (0)