From 14256f73be974bae102ce67543d1acaf9bf4b29c Mon Sep 17 00:00:00 2001 From: Claudio Costa Date: Wed, 19 May 2021 16:16:26 +0200 Subject: [PATCH] Fix races (#17646) --- config/store.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/config/store.go b/config/store.go index 3a96529a10..caba220982 100644 --- a/config/store.go +++ b/config/store.go @@ -179,9 +179,7 @@ func (s *Store) Set(newCfg *model.Config) (*model.Config, error) { } newCfg = newCfg.Clone() - // no need to clone these as cached configs are getting replaced - // with brand new objects. - oldCfg := s.config + oldCfg := s.config.Clone() oldCfgNoEnv := s.configNoEnv // Setting defaults allows us to accept partial config objects. @@ -255,7 +253,7 @@ func (s *Store) Load() error { oldCfg := &model.Config{} if s.config != nil { - oldCfg = s.config + oldCfg = s.config.Clone() } configBytes, err := s.backingStore.Load()