core: Refine mutex during reloads (fix #5628) (#5645)

Separate currentCtxMu to protect currentCtx, and a new
rawCfgMu to protect rawCfg and synchronize loads.
This commit is contained in:
Matt Holt
2023-07-21 15:32:20 -06:00
committed by GitHub
parent f857b32d65
commit b51dc5d5d0
3 changed files with 42 additions and 20 deletions

View File

@ -1016,9 +1016,9 @@ func handleConfigID(w http.ResponseWriter, r *http.Request) error {
id := parts[2]
// map the ID to the expanded path
currentCtxMu.RLock()
rawCfgMu.RLock()
expanded, ok := rawCfgIndex[id]
currentCtxMu.RUnlock()
rawCfgMu.RUnlock()
if !ok {
return APIError{
HTTPStatus: http.StatusNotFound,