Skip to content

Commit 9951869

Browse files
committed
🌱 TypedRequestForOwner: Decrease priority when unchanged
We already did this for RequestForOwner, but not the typed variation, this change adds that.
1 parent c7d5d83 commit 9951869

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

pkg/handler/enqueue_owner.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ type OwnerOption func(e enqueueRequestForOwnerInterface)
4848
//
4949
// - a handler.enqueueRequestForOwner EventHandler with an OwnerType of ReplicaSet and OnlyControllerOwner set to true.
5050
func EnqueueRequestForOwner(scheme *runtime.Scheme, mapper meta.RESTMapper, ownerType client.Object, opts ...OwnerOption) EventHandler {
51-
return WithLowPriorityWhenUnchanged(TypedEnqueueRequestForOwner[client.Object](scheme, mapper, ownerType, opts...))
51+
return TypedEnqueueRequestForOwner[client.Object](scheme, mapper, ownerType, opts...)
5252
}
5353

5454
// TypedEnqueueRequestForOwner enqueues Requests for the Owners of an object. E.g. the object that created
@@ -72,7 +72,7 @@ func TypedEnqueueRequestForOwner[object client.Object](scheme *runtime.Scheme, m
7272
for _, opt := range opts {
7373
opt(e)
7474
}
75-
return e
75+
return WithLowPriorityWhenUnchanged(e)
7676
}
7777

7878
// OnlyControllerOwner if provided will only look at the first OwnerReference with Controller: true.

pkg/handler/eventhandler_test.go

+10
Original file line numberDiff line numberDiff line change
@@ -798,6 +798,16 @@ var _ = Describe("Eventhandler", func() {
798798
)
799799
},
800800
},
801+
{
802+
name: "TypedEnqueueRequestForOwner",
803+
handler: func() handler.EventHandler {
804+
return handler.TypedEnqueueRequestForOwner[client.Object](
805+
scheme.Scheme,
806+
mapper,
807+
&corev1.Pod{},
808+
)
809+
},
810+
},
801811
{
802812
name: "Funcs",
803813
handler: func() handler.EventHandler {

0 commit comments

Comments
 (0)