Skip to content

Commit

Permalink
queueinformer: don't double register informers (#3007)
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
stevekuznetsov authored Aug 8, 2023
1 parent a7f102a commit 2be5e58
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/lib/queueinformer/queueinformer_operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,12 @@ func (o *operator) RegisterInformer(informer cache.SharedIndexInformer) error {
}

func (o *operator) registerInformer(informer cache.SharedIndexInformer) {
// never double-register an informer
for i := range o.informers {
if o.informers[i] == informer {
return
}
}
o.informers = append(o.informers, informer)
o.addHasSynced(informer.HasSynced)
}
Expand Down

0 comments on commit 2be5e58

Please sign in to comment.