Skip to content

Commit

Permalink
fix: secrets cache no longer busy loops when no providers to sync (#2179
Browse files Browse the repository at this point in the history
)

CPU was busy just looping again and again due to early `continue`
without setting the `next` time.

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
matt2e and github-actions[bot] authored Jul 26, 2024
1 parent b949721 commit 16f9795
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion common/configuration/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ func (c *cache[R]) sync(ctx context.Context) {

// Can not calculate next sync date for each provider as sync intervals can change (eg when follower becomes leader)
case <-time.After(time.Until(next)):
next = time.Now().Add(time.Second)
wg := &sync.WaitGroup{}

providersToSync := []*cacheProvider[R]{}
Expand Down Expand Up @@ -173,7 +174,6 @@ func (c *cache[R]) sync(ctx context.Context) {
}(cp)
}
wg.Wait()
next = time.Now().Add(time.Second)
}
}
}
Expand Down

0 comments on commit 16f9795

Please sign in to comment.