File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed
pkg/controller/priorityqueue Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -129,6 +129,10 @@ type priorityqueue[T comparable] struct {
129129}
130130
131131func (w * priorityqueue [T ]) AddWithOpts (o AddOpts , items ... T ) {
132+ if w .shutdown .Load () {
133+ return
134+ }
135+
132136 w .lock .Lock ()
133137 defer w .lock .Unlock ()
134138
@@ -274,16 +278,15 @@ func (w *priorityqueue[T]) AddRateLimited(item T) {
274278}
275279
276280func (w * priorityqueue [T ]) GetWithPriority () (_ T , priority int , shutdown bool ) {
277- w .waiters .Add (1 )
278-
279- w .notifyItemOrWaiterAdded ()
280-
281- // ref: https://github.com/kubernetes-sigs/controller-runtime/issues/3239
282281 if w .shutdown .Load () {
283282 var zero T
284283 return zero , 0 , true
285284 }
286285
286+ w .waiters .Add (1 )
287+
288+ w .notifyItemOrWaiterAdded ()
289+
287290 item := <- w .get
288291
289292 return item .Key , item .Priority , w .shutdown .Load ()
You can’t perform that action at this time.
0 commit comments