From 7bef7248fd64bd858492f8412c94693dcd7f20d0 Mon Sep 17 00:00:00 2001 From: Alexander Scheel Date: Thu, 4 May 2023 14:14:06 +0000 Subject: [PATCH] backport of commit b81a94b80c222ec57d60e335338d2d787a6c6cc2 --- vault/rollback.go | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/vault/rollback.go b/vault/rollback.go index 140600ed1462..c6c13b0c39e1 100644 --- a/vault/rollback.go +++ b/vault/rollback.go @@ -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 } @@ -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