Skip to content

Commit

Permalink
Merge pull request #7644 from ywk253100/240409_list
Browse files Browse the repository at this point in the history
[cherry-pick]Empty the list before next round of listing
  • Loading branch information
qiuming-best authored Apr 10, 2024
2 parents 2c57ed8 + 27a4bfc commit 35177cd
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 35177cd

Please sign in to comment.