File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
pkg/scheduler/backend/queue Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -402,6 +402,12 @@ func (aq *activeQueue) done(pod types.UID) {
402
402
aq .lock .Lock ()
403
403
defer aq .lock .Unlock ()
404
404
405
+ aq .unlockedDone (pod )
406
+ }
407
+
408
+ // unlockedDone is used by the activeQueue internally and doesn't take the lock itself.
409
+ // It assumes the lock is already taken outside before the method is called.
410
+ func (aq * activeQueue ) unlockedDone (pod types.UID ) {
405
411
inFlightPod , ok := aq .inFlightPods [pod ]
406
412
if ! ok {
407
413
// This Pod is already done()ed.
@@ -446,15 +452,15 @@ func (aq *activeQueue) done(pod types.UID) {
446
452
447
453
// close closes the activeQueue.
448
454
func (aq * activeQueue ) close () {
455
+ aq .lock .Lock ()
456
+ defer aq .lock .Unlock ()
449
457
// We should call done() for all in-flight pods to clean up the inFlightEvents metrics.
450
458
// It's safe even if the binding cycle running asynchronously calls done() afterwards
451
459
// done() will just be a no-op.
452
460
for pod := range aq .inFlightPods {
453
- aq .done (pod )
461
+ aq .unlockedDone (pod )
454
462
}
455
- aq .lock .Lock ()
456
463
aq .closed = true
457
- aq .lock .Unlock ()
458
464
}
459
465
460
466
// broadcast notifies the pop() operation that new pod(s) was added to the activeQueue.
You can’t perform that action at this time.
0 commit comments