Skip to content

Commit

Permalink
backport of commit b81a94b (hashicorp#20511)
Browse files Browse the repository at this point in the history
Co-authored-by: Alexander Scheel <alex.scheel@hashicorp.com>
  • Loading branch information
1 parent 920f3c7 commit da7618a
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions vault/rollback.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,13 @@ type RollbackManager struct {
inflight map[string]*rollbackState
inflightLock sync.RWMutex

doneCh chan struct{}
shutdown bool
shutdownCh chan struct{}
shutdownLock sync.Mutex
stopTicker chan struct{}
quitContext context.Context
doneCh chan struct{}
shutdown bool
shutdownCh chan struct{}
shutdownLock sync.Mutex
stopTicker chan struct{}
tickerIsStopped bool
quitContext context.Context

core *Core
}
Expand Down Expand Up @@ -100,7 +101,10 @@ func (m *RollbackManager) Stop() {
//
// THIS SHOULD ONLY BE CALLED FROM TEST HELPERS.
func (m *RollbackManager) StopTicker() {
close(m.stopTicker)
if !m.tickerIsStopped {
close(m.stopTicker)
m.tickerIsStopped = true
}
}

// run is a long running routine to periodically invoke rollback
Expand Down

0 comments on commit da7618a

Please sign in to comment.