Skip to content

Commit 0d00fff

Browse files
authored
fix: removing time boosts reconciliation deadlock (#127)
1 parent f189084 commit 0d00fff

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

internal/boost/manager.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@ func (m *managerImpl) Start(ctx context.Context) error {
257257
m.log.V(5).Info("tick...")
258258
m.validateTimePolicyBoosts(ctx)
259259
case <-ctx.Done():
260+
m.log.Info("stopping")
260261
return nil
261262
}
262263
}
@@ -323,13 +324,16 @@ func (m *managerImpl) mapOrphanedPods(ctx context.Context, boost StartupCPUBoost
323324
// and reverts the resources for violated pods.
324325
func (m *managerImpl) validateTimePolicyBoosts(ctx context.Context) {
325326
m.RLock()
326-
defer m.RUnlock()
327+
timeBoosts := make([]StartupCPUBoost, 0)
328+
timeBoosts = append(timeBoosts, m.timedBoosts.ListAll()...)
329+
m.RUnlock()
330+
327331
revertTasks := make(chan *podRevertTask, m.maxGoroutines)
328332
reconcileTasks := make(chan *reconcile.Request, m.maxGoroutines)
329333
errors := make(chan error, m.maxGoroutines)
330334

331335
go func() {
332-
for _, boost := range m.timedBoosts.ListAll() {
336+
for _, boost := range timeBoosts {
333337
for _, pod := range boost.ValidatePolicy(ctx, duration.FixedDurationPolicyName) {
334338
revertTasks <- &podRevertTask{
335339
boost: boost,

0 commit comments

Comments
 (0)