Skip to content

Commit

Permalink
factory/base_controller: properly synchronize runPeriodicalResync fun…
Browse files Browse the repository at this point in the history
…ction
  • Loading branch information
p0lyn0mial committed Jun 2, 2023
1 parent ab17946 commit 83209ff
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions pkg/controller/factory/base_controller.go
Expand Up @@ -133,7 +133,7 @@ func (c *baseController) Run(ctx context.Context, workers int) {
workerWg.Add(1)
go func() {
defer workerWg.Done()
c.runPeriodicalResync(ctx, c.resyncEvery)
wait.UntilWithContext(ctx, func(ctx context.Context) { c.syncContext.Queue().Add(DefaultQueueKey) }, c.resyncEvery)
}()
}

Expand Down Expand Up @@ -171,15 +171,6 @@ func (c *baseController) Sync(ctx context.Context, syncCtx SyncContext) error {
return c.sync(ctx, syncCtx)
}

func (c *baseController) runPeriodicalResync(ctx context.Context, interval time.Duration) {
if interval == 0 {
return
}
go wait.UntilWithContext(ctx, func(ctx context.Context) {
c.syncContext.Queue().Add(DefaultQueueKey)
}, interval)
}

// runWorker runs a single worker
// The worker is asked to terminate when the passed context is cancelled and is given terminationGraceDuration time
// to complete its shutdown.
Expand Down

0 comments on commit 83209ff

Please sign in to comment.