Skip to content

Commit

Permalink
Fix upgrade window periodics (#48214)
Browse files Browse the repository at this point in the history
#47731 consolidated the auth periodics to use a multi.Interval,
however the upgrade window check called from the periodic launched
it's own periodic, leading to a runaway number of upgrade window
checks. This removes the extra periodic to reduce load upstream.
  • Loading branch information
rosstimothy authored Oct 31, 2024
1 parent 13a5dcc commit 8948c2c
Showing 1 changed file with 1 addition and 25 deletions.
26 changes: 1 addition & 25 deletions lib/auth/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -1202,30 +1202,6 @@ func (a *Server) syncUpgradeWindowStartHour(ctx context.Context) error {
return nil
}

func (a *Server) periodicSyncUpgradeWindowStartHour() {
checkInterval := interval.New(interval.Config{
Duration: time.Minute * 3,
FirstDuration: utils.FullJitter(time.Second * 30),
Jitter: retryutils.NewSeventhJitter(),
})
defer checkInterval.Stop()

for {
select {
case <-checkInterval.Next():
if err := a.syncUpgradeWindowStartHour(a.closeCtx); err != nil {
if a.closeCtx.Err() == nil {
// we run this periodic at a fairly high frequency, so errors are just
// logged but otherwise ignored.
log.Warnf("Failed to sync upgrade window start hour: %v", err)
}
}
case <-a.closeCtx.Done():
return
}
}
}

// periodicIntervalKey is used to uniquely identify the subintervals registered with
// the interval.MultiInterval instance that we use for managing periodics operations.

Expand Down Expand Up @@ -1426,7 +1402,7 @@ func (a *Server) runPeriodicOperations() {
case dynamicLabelsCheckKey:
go a.syncDynamicLabelsAlert(a.closeCtx)
case upgradeWindowCheckKey:
go a.periodicSyncUpgradeWindowStartHour()
go a.syncUpgradeWindowStartHour(a.closeCtx)
case roleCountKey:
go a.tallyRoles(a.closeCtx)
}
Expand Down

0 comments on commit 8948c2c

Please sign in to comment.