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 {
129
129
}
130
130
131
131
func (w * priorityqueue [T ]) AddWithOpts (o AddOpts , items ... T ) {
132
+ if w .shutdown .Load () {
133
+ return
134
+ }
135
+
132
136
w .lock .Lock ()
133
137
defer w .lock .Unlock ()
134
138
@@ -274,16 +278,15 @@ func (w *priorityqueue[T]) AddRateLimited(item T) {
274
278
}
275
279
276
280
func (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
282
281
if w .shutdown .Load () {
283
282
var zero T
284
283
return zero , 0 , true
285
284
}
286
285
286
+ w .waiters .Add (1 )
287
+
288
+ w .notifyItemOrWaiterAdded ()
289
+
287
290
item := <- w .get
288
291
289
292
return item .Key , item .Priority , w .shutdown .Load ()
You can’t perform that action at this time.
0 commit comments