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() {
231231 var toDelete []* item [T ]
232232
233233 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.
234238 pivot := item [T ]{
235239 Key : key ,
236240 AddedCounter : 0 ,
@@ -254,6 +258,7 @@ func (w *priorityqueue[T]) spin() {
254258 nextItemReadyAt = * item .ReadyAt
255259 }
256260
261+ // Adjusting the pivot item moves the ascend to the next lower priority
257262 pivot .Priority = item .Priority - 1
258263 pivotChange = true
259264 return false
You can’t perform that action at this time.
0 commit comments