Skip to content

Commit

Permalink
review suggestions
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Pana <[email protected]>
  • Loading branch information
acpana committed Nov 22, 2023
1 parent a280fb7 commit c87e934
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
5 changes: 3 additions & 2 deletions pkg/cachemanager/cachemanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -405,8 +405,9 @@ func (c *CacheManager) manageCache(ctx context.Context) {

// first make sure there is no drift between c.gvksToSync and watch manager
if c.danglingWatches.Size() > 0 {
err := c.replaceWatchSet(ctx)
log.V(logging.DebugLevel).Info("error replacing watch set", "error", err)
if err := c.replaceWatchSet(ctx); err != nil {
log.V(logging.DebugLevel).Info("error replacing watch set", "error", err)
}
}

c.wipeCacheIfNeeded(ctx)
Expand Down
2 changes: 1 addition & 1 deletion pkg/readiness/pruner/pruner.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func (e *ExpectationsPruner) Start(ctx context.Context) error {
// further manage the data sync expectations.
return nil
}
if e.tracker.SyncSourcesSatisfied() {
if e.tracker.SyncSetAndConfigSatisfied() {
e.pruneUnwatchedGVKs()
}
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/readiness/pruner/pruner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ func Test_ExpectationsPruner_missedInformers(t *testing.T) {
testutils.StartManager(ctx, t, testRes.manager)

require.Eventually(t, func() bool {
return testRes.expectationsPruner.tracker.SyncSourcesSatisfied()
return testRes.expectationsPruner.tracker.SyncSetAndConfigSatisfied()
}, timeout, tick, "waiting on sync sources to get satisfied")

// As configMapGVK is absent from this syncset-a, the CacheManager will never observe configMapGVK
Expand Down
8 changes: 4 additions & 4 deletions pkg/readiness/ready_tracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ func (t *Tracker) Run(ctx context.Context) error {
})
}
grp.Go(func() error {
return t.trackSyncSources(gctx)
return t.trackConfigAndSyncSets(gctx)
})

grp.Go(func() error {
Expand Down Expand Up @@ -406,7 +406,7 @@ func (t *Tracker) Populated() bool {
}

// Returns whether both the Config and all SyncSet expectations have been Satisfied.
func (t *Tracker) SyncSourcesSatisfied() bool {
func (t *Tracker) SyncSetAndConfigSatisfied() bool {
satisfied := t.config.Satisfied()
if operations.HasValidationOperations() {
satisfied = satisfied && t.syncsets.Satisfied()
Expand Down Expand Up @@ -732,10 +732,10 @@ func (t *Tracker) trackConstraintTemplates(ctx context.Context) error {
return nil
}

// trackSyncSources sets expectations for cached data as specified by the singleton Config resource.
// trackConfigAndSyncSets sets expectations for cached data as specified by the singleton Config resource.
// and any SyncSet resources present on the cluster.
// Works best effort and fails-open if a resource cannot be fetched or does not exist.
func (t *Tracker) trackSyncSources(ctx context.Context) error {
func (t *Tracker) trackConfigAndSyncSets(ctx context.Context) error {
defer func() {
t.config.ExpectationsDone()
log.V(logging.DebugLevel).Info("config expectations populated")
Expand Down

0 comments on commit c87e934

Please sign in to comment.