core: synchronize Stop with concurrent config reloads (#8038)

Signed-off-by: hendrixx-cnc <tjhendrx@icloud.com>
This commit is contained in:
X 2026-09-19 09:02:47 -07:00 committed by GitHub
parent df77f8bde1
commit 128b9e75e0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -692,21 +692,19 @@ type ConfigLoader interface {
// stop the others. Stop should only be called
// if not replacing with a new config.
func Stop() error {
currentCtxMu.RLock()
ctx := currentCtx
currentCtxMu.RUnlock()
rawCfgMu.Lock()
unsyncedStop(ctx)
defer rawCfgMu.Unlock()
currentCtxMu.Lock()
ctx := currentCtx
currentCtx = Context{}
currentCtxMu.Unlock()
unsyncedStop(ctx)
rawCfgJSON = nil
rawCfgIndex = nil
rawCfg[rawConfigKey] = nil
rawCfgMu.Unlock()
return nil
}