From ba9c1a249c969447b9a6bfb83f66cf4bc4be1787 Mon Sep 17 00:00:00 2001 From: Chris Hoffman Date: Fri, 19 Oct 2018 15:21:42 -0400 Subject: [PATCH] safely clean up loaded map (#5558) --- vault/expiration.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/vault/expiration.go b/vault/expiration.go index 574c58e5b2..4d3ceff54a 100644 --- a/vault/expiration.go +++ b/vault/expiration.go @@ -497,9 +497,12 @@ func (m *ExpirationManager) Restore(errorFunc func()) (retErr error) { wg.Wait() m.restoreModeLock.Lock() - m.restoreLoaded = sync.Map{} - m.restoreLocks = nil atomic.StoreInt32(m.restoreMode, 0) + m.restoreLoaded.Range(func(k, v interface{}) bool { + m.restoreLoaded.Delete(k) + return true + }) + m.restoreLocks = nil m.restoreModeLock.Unlock() m.logger.Info("lease restore complete")