Skip to content

Commit 2be5e58

Browse files
queueinformer: don't double register informers (#3007)
The abstraction here doesn't let you re-use an informer without also causing it to be re-registered and re-started, which is invalid. Signed-off-by: Steve Kuznetsov <[email protected]>
1 parent a7f102a commit 2be5e58

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

pkg/lib/queueinformer/queueinformer_operator.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,12 @@ func (o *operator) RegisterInformer(informer cache.SharedIndexInformer) error {
141141
}
142142

143143
func (o *operator) registerInformer(informer cache.SharedIndexInformer) {
144+
// never double-register an informer
145+
for i := range o.informers {
146+
if o.informers[i] == informer {
147+
return
148+
}
149+
}
144150
o.informers = append(o.informers, informer)
145151
o.addHasSynced(informer.HasSynced)
146152
}

0 commit comments

Comments
 (0)