Skip to content

Commit 4ee5550

Browse files
committed
Change enqueuing items to use Add instead of AddRateLimited.
Calling 'AddRateLimited' appears to indicate that an error has occurred for the rate limiting queue. This triggers exponential backoff behavior, so if a large number of elements (20+) are owned by a resource and the controller happens to encounter an error, this will cause exponential backoff to reach the 1000 second limit.
1 parent 05f0100 commit 4ee5550

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

pkg/controller/eventhandlers/eventhandlers.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,37 +53,37 @@ func (mp MapAndEnqueue) Get(r workqueue.RateLimitingInterface) cache.ResourceEve
5353
return
5454
}
5555
}
56-
mp.addRateLimited(r, obj)
56+
mp.add(r, obj)
5757
},
5858
UpdateFunc: func(old, obj interface{}) {
5959
for _, p := range mp.Predicates {
6060
if !p.HandleUpdate(old, obj) {
6161
return
6262
}
6363
}
64-
mp.addRateLimited(r, obj)
64+
mp.add(r, obj)
6565
},
6666
DeleteFunc: func(obj interface{}) {
6767
for _, p := range mp.Predicates {
6868
if !p.HandleDelete(obj) {
6969
return
7070
}
7171
}
72-
mp.addRateLimited(r, obj)
72+
mp.add(r, obj)
7373
},
7474
}
7575
}
7676

77-
// addRateLimited maps the obj to a string. If the string is non-empty, it is enqueued.
78-
func (mp MapAndEnqueue) addRateLimited(r workqueue.RateLimitingInterface, obj interface{}) {
77+
// add maps the obj to a string. If the string is non-empty, it is enqueued.
78+
func (mp MapAndEnqueue) add(r workqueue.RateLimitingInterface, obj interface{}) {
7979
if mp.Map != nil {
8080
if k := mp.Map(obj); len(k) > 0 {
81-
r.AddRateLimited(k)
81+
r.Add(k)
8282
}
8383
}
8484
if mp.MultiMap != nil {
8585
for _, k := range mp.MultiMap(obj) {
86-
r.AddRateLimited(k.Namespace + "/" + k.Name)
86+
r.Add(k.Namespace + "/" + k.Name)
8787
}
8888
}
8989
}

pkg/controller/listeningqueue.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ type listeningQueue struct {
4545
func (q *listeningQueue) watchChannel(source <-chan string) error {
4646
go func() {
4747
for msg := range source {
48-
q.AddRateLimited(msg)
48+
q.Add(msg)
4949
}
5050
}()
5151
return nil

0 commit comments

Comments
 (0)