Skip to content

Commit

Permalink
Address comment
Browse files Browse the repository at this point in the history
  • Loading branch information
fabriziopandini committed Oct 11, 2021
1 parent 69e892b commit 3bdf1ad
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pkg/manager/internal.go
Original file line number Diff line number Diff line change
Expand Up @@ -550,8 +550,11 @@ func (cm *controllerManager) engageStopProcedure(stopComplete <-chan struct{}) e
if cm.gracefulShutdownTimeout == 0 {
return nil
}
cm.addMu.RLock()
defer cm.addMu.RUnlock()

// NOTE: it is required to get the addMu write lock, so we are sure that we not starting any runnable
// while we start waitForRunnableToEnd.
cm.addMu.Lock()
defer cm.addMu.Unlock()

// Note: stopProcedureEngaged is used by Add, AddMetricsExtraHandler, AddReadyzCheck, but it is safe to change here because
// addMu.RLock() prevents the above functions to be executed concurrently with this operation.
Expand Down

0 comments on commit 3bdf1ad

Please sign in to comment.