Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only log stopping rollback manager once #20041

Merged
merged 1 commit into from
Apr 10, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion vault/rollback.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,12 @@ func (m *RollbackManager) Stop() {
m.inflightAll.Wait()
}

// StopTicker stops the automatic Rollback manager's ticker, causing us
// to not do automatic rollbacks. This is useful for testing plugin's
// periodic function's behavior, without trying to race against the
// rollback manager proper.
//
// THIS SHOULD ONLY BE CALLED FROM TEST HELPERS.
func (m *RollbackManager) StopTicker() {
close(m.stopTicker)
}
Expand All @@ -104,6 +110,7 @@ func (m *RollbackManager) StopTicker() {
func (m *RollbackManager) run() {
m.logger.Info("starting rollback manager")
tick := time.NewTicker(m.period)
logTestStopOnce := false
defer tick.Stop()
defer close(m.doneCh)
for {
Expand All @@ -116,7 +123,10 @@ func (m *RollbackManager) run() {
return

case <-m.stopTicker:
m.logger.Info("stopping rollback manager ticker for tests")
if !logTestStopOnce {
m.logger.Info("stopping rollback manager ticker for tests")
logTestStopOnce = true
}
tick.Stop()
}
}
Expand Down