Skip to content

Commit

Permalink
Merge pull request #7634 from ywk253100/240408_periodical_queue
Browse files Browse the repository at this point in the history
Empty the list before next round of listing
  • Loading branch information
ywk253100 authored Apr 9, 2024
2 parents c3a3992 + 91774af commit 7b3e6a4
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 7b3e6a4

Please sign in to comment.