Skip to content

Commit

Permalink
Empty the list before next round of listing
Browse files Browse the repository at this point in the history
Empty the list before next round of listing

Signed-off-by: Wenkai Yin(尹文开) <yinw@vmware.com>
  • Loading branch information
ywk253100 committed Apr 8, 2024
1 parent f85f877 commit 91774af
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/util/kube/periodical_enqueue_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ type PeriodicalEnqueueSourceOption struct {
func (p *PeriodicalEnqueueSource) Start(ctx context.Context, h handler.EventHandler, q workqueue.RateLimitingInterface, predicates ...predicate.Predicate) error {
go wait.Until(func() {
p.logger.Debug("enqueueing resources ...")
// empty the list otherwise the result of the new list call will be appended
if err := meta.SetList(p.objList, nil); err != nil {
p.logger.WithError(err).Error("error reset resource list")
return
}
if err := p.List(ctx, p.objList); err != nil {
p.logger.WithError(err).Error("error listing resources")
return
Expand Down

0 comments on commit 91774af

Please sign in to comment.