Skip to content

use Add instead of AddRateLimited in eventhandlers #64

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions pkg/handler/enqueue.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func (e *EnqueueRequestForObject) Create(evt event.CreateEvent, q workqueue.Rate
enqueueLog.Error(nil, "CreateEvent received with no metadata", "CreateEvent", evt)
return
}
q.AddRateLimited(reconcile.Request{NamespacedName: types.NamespacedName{
q.Add(reconcile.Request{NamespacedName: types.NamespacedName{
Name: evt.Meta.GetName(),
Namespace: evt.Meta.GetNamespace(),
}})
Expand All @@ -48,7 +48,7 @@ func (e *EnqueueRequestForObject) Create(evt event.CreateEvent, q workqueue.Rate
// Update implements EventHandler
func (e *EnqueueRequestForObject) Update(evt event.UpdateEvent, q workqueue.RateLimitingInterface) {
if evt.MetaOld != nil {
q.AddRateLimited(reconcile.Request{NamespacedName: types.NamespacedName{
q.Add(reconcile.Request{NamespacedName: types.NamespacedName{
Name: evt.MetaOld.GetName(),
Namespace: evt.MetaOld.GetNamespace(),
}})
Expand All @@ -57,7 +57,7 @@ func (e *EnqueueRequestForObject) Update(evt event.UpdateEvent, q workqueue.Rate
}

if evt.MetaNew != nil {
q.AddRateLimited(reconcile.Request{NamespacedName: types.NamespacedName{
q.Add(reconcile.Request{NamespacedName: types.NamespacedName{
Name: evt.MetaNew.GetName(),
Namespace: evt.MetaNew.GetNamespace(),
}})
Expand All @@ -72,7 +72,7 @@ func (e *EnqueueRequestForObject) Delete(evt event.DeleteEvent, q workqueue.Rate
enqueueLog.Error(nil, "DeleteEvent received with no metadata", "DeleteEvent", evt)
return
}
q.AddRateLimited(reconcile.Request{NamespacedName: types.NamespacedName{
q.Add(reconcile.Request{NamespacedName: types.NamespacedName{
Name: evt.Meta.GetName(),
Namespace: evt.Meta.GetNamespace(),
}})
Expand All @@ -84,7 +84,7 @@ func (e *EnqueueRequestForObject) Generic(evt event.GenericEvent, q workqueue.Ra
enqueueLog.Error(nil, "GenericEvent received with no metadata", "GenericEvent", evt)
return
}
q.AddRateLimited(reconcile.Request{NamespacedName: types.NamespacedName{
q.Add(reconcile.Request{NamespacedName: types.NamespacedName{
Name: evt.Meta.GetName(),
Namespace: evt.Meta.GetNamespace(),
}})
Expand Down
2 changes: 1 addition & 1 deletion pkg/handler/enqueue_mapped.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func (e *EnqueueRequestsFromMapFunc) Generic(evt event.GenericEvent, q workqueue

func (e *EnqueueRequestsFromMapFunc) mapAndEnqueue(q workqueue.RateLimitingInterface, object MapObject) {
for _, req := range e.ToRequests.Map(object) {
q.AddRateLimited(req)
q.Add(req)
}
}

Expand Down
10 changes: 5 additions & 5 deletions pkg/handler/enqueue_owner.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,31 +56,31 @@ type EnqueueRequestForOwner struct {
// Create implements EventHandler
func (e *EnqueueRequestForOwner) Create(evt event.CreateEvent, q workqueue.RateLimitingInterface) {
for _, req := range e.getOwnerReconcileRequest(evt.Meta) {
q.AddRateLimited(req)
q.Add(req)
}
}

// Update implements EventHandler
func (e *EnqueueRequestForOwner) Update(evt event.UpdateEvent, q workqueue.RateLimitingInterface) {
for _, req := range e.getOwnerReconcileRequest(evt.MetaOld) {
q.AddRateLimited(req)
q.Add(req)
}
for _, req := range e.getOwnerReconcileRequest(evt.MetaNew) {
q.AddRateLimited(req)
q.Add(req)
}
}

// Delete implements EventHandler
func (e *EnqueueRequestForOwner) Delete(evt event.DeleteEvent, q workqueue.RateLimitingInterface) {
for _, req := range e.getOwnerReconcileRequest(evt.Meta) {
q.AddRateLimited(req)
q.Add(req)
}
}

// Generic implements EventHandler
func (e *EnqueueRequestForOwner) Generic(evt event.GenericEvent, q workqueue.RateLimitingInterface) {
for _, req := range e.getOwnerReconcileRequest(evt.Meta) {
q.AddRateLimited(req)
q.Add(req)
}
}

Expand Down