From 8e31160dbdafc06172da3afa6367ab92c3e65ebf Mon Sep 17 00:00:00 2001 From: Tim Ross Date: Thu, 31 Oct 2024 09:34:01 -0400 Subject: [PATCH] Fix upgrade window periodics #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. --- lib/auth/auth.go | 26 +------------------------- 1 file changed, 1 insertion(+), 25 deletions(-) diff --git a/lib/auth/auth.go b/lib/auth/auth.go index 8b66ba87e389b..05ec154ab725a 100644 --- a/lib/auth/auth.go +++ b/lib/auth/auth.go @@ -1254,30 +1254,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. @@ -1478,7 +1454,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) }