File tree Expand file tree Collapse file tree 1 file changed +5
-0
lines changed
pkg/controller/priorityqueue Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -231,6 +231,10 @@ func (w *priorityqueue[T]) spin() {
231
231
var toDelete []* item [T ]
232
232
233
233
var key T
234
+
235
+ // Items in the queue tree are sorted first by priority and second by readiness, so
236
+ // items with a lower priority might be ready further down in the queue.
237
+ // In search for ready items we use the pivot item to skip through priorities without ascending the whole tree.
234
238
pivot := item [T ]{
235
239
Key : key ,
236
240
AddedCounter : 0 ,
@@ -254,6 +258,7 @@ func (w *priorityqueue[T]) spin() {
254
258
nextItemReadyAt = * item .ReadyAt
255
259
}
256
260
261
+ // Adjusting the pivot item moves the ascend to the next lower priority
257
262
pivot .Priority = item .Priority - 1
258
263
pivotChange = true
259
264
return false
You can’t perform that action at this time.
0 commit comments