Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 10068c8

Browse files
committedFeb 20, 2025··
implement priority queue
Signed-off-by: Troy Connor <troy0820@users.noreply.github.com>
1 parent a3bd1c0 commit 10068c8

File tree

1 file changed

+2
-13
lines changed

1 file changed

+2
-13
lines changed
 

‎pkg/handler/eventhandler.go

+2-13
Original file line numberDiff line numberDiff line change
@@ -101,13 +101,7 @@ func (f *funcs[T, R]) Create(ctx context.Context, evt event.TypedCreateEvent[T],
101101
Name: evt.Object.GetName(),
102102
Namespace: evt.Object.GetNamespace(),
103103
}}
104-
105-
priorityQueue, isPriorityQueue := q.(priorityqueue.PriorityQueue[reconcile.Request])
106-
if !isPriorityQueue {
107-
q.Add(item)
108-
return
109-
}
110-
addToQueueCreate(priorityQueue, evt, item)
104+
addToQueueCreate(q, evt, item)
111105
}
112106

113107
// Update implements EventHandler.
@@ -218,12 +212,7 @@ func WithLowPriorityWhenUnchanged[object client.Object, request comparable](u Ty
218212
u.Create(ctx, tce, workqueueWithCustomAddFunc[request]{
219213
TypedRateLimitingInterface: trli,
220214
addFunc: func(item request, q workqueue.TypedRateLimitingInterface[request]) {
221-
priorityQueue, isPriorityQueue := q.(priorityqueue.PriorityQueue[request])
222-
if !isPriorityQueue {
223-
q.Add(item)
224-
return
225-
}
226-
addToQueueCreate(priorityQueue, tce, item)
215+
addToQueueCreate(q, tce, item)
227216
},
228217
})
229218
},

0 commit comments

Comments
 (0)
Please sign in to comment.