Skip to content

Commit aff6932

Browse files
committed
wrap funcs{} with priorityQueue
Signed-off-by: Troy Connor <[email protected]>
1 parent 79117b2 commit aff6932

File tree

1 file changed

+0
-42
lines changed

1 file changed

+0
-42
lines changed

pkg/handler/eventhandler.go

-42
Original file line numberDiff line numberDiff line change
@@ -111,27 +111,6 @@ type TypedFuncs[object any, request comparable] struct {
111111
// Create implements EventHandler.
112112
func (h TypedFuncs[object, request]) Create(ctx context.Context, e event.TypedCreateEvent[object], q workqueue.TypedRateLimitingInterface[request]) {
113113
if h.CreateFunc != nil {
114-
h.CreateFunc = func(ctx context.Context, e event.TypedCreateEvent[object], trli workqueue.TypedRateLimitingInterface[request]) {
115-
h.Create(ctx, e, workqueueWithCustomAddFunc[request]{
116-
TypedRateLimitingInterface: trli,
117-
addFunc: func(item request, q workqueue.TypedRateLimitingInterface[request]) {
118-
priorityQueue, isPriorityQueue := q.(priorityqueue.PriorityQueue[request])
119-
if !isPriorityQueue {
120-
q.Add(item)
121-
return
122-
}
123-
var priority int
124-
obj, ok := any(e).(event.TypedCreateEvent[client.Object])
125-
if !ok {
126-
return
127-
}
128-
if isObjectUnchanged(obj) {
129-
priority = LowPriority
130-
}
131-
priorityQueue.AddWithOpts(priorityqueue.AddOpts{Priority: priority}, item)
132-
},
133-
})
134-
}
135114
h.CreateFunc(ctx, e, q)
136115
}
137116
}
@@ -146,27 +125,6 @@ func (h TypedFuncs[object, request]) Delete(ctx context.Context, e event.TypedDe
146125
// Update implements EventHandler.
147126
func (h TypedFuncs[object, request]) Update(ctx context.Context, e event.TypedUpdateEvent[object], q workqueue.TypedRateLimitingInterface[request]) {
148127
if h.UpdateFunc != nil {
149-
h.UpdateFunc = func(ctx context.Context, tue event.TypedUpdateEvent[object], trli workqueue.TypedRateLimitingInterface[request]) {
150-
h.Update(ctx, e, workqueueWithCustomAddFunc[request]{
151-
TypedRateLimitingInterface: trli,
152-
addFunc: func(item request, q workqueue.TypedRateLimitingInterface[request]) {
153-
priorityQueue, isPriorityQueue := q.(priorityqueue.PriorityQueue[request])
154-
if !isPriorityQueue {
155-
q.Add(item)
156-
return
157-
}
158-
var priority int
159-
obj, ok := any(tue).(event.TypedUpdateEvent[client.Object])
160-
if !ok {
161-
return
162-
}
163-
if obj.ObjectOld.GetResourceVersion() == obj.ObjectNew.GetResourceVersion() {
164-
priority = LowPriority
165-
}
166-
priorityQueue.AddWithOpts(priorityqueue.AddOpts{Priority: priority}, item)
167-
},
168-
})
169-
}
170128
h.UpdateFunc(ctx, e, q)
171129
}
172130
}

0 commit comments

Comments
 (0)