fix: replace req context by locker context (#17880)

This commit is contained in:
jiuker 2023-08-20 13:09:07 +08:00 committed by GitHub
parent 7219ae530e
commit e3ea97c964
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1147,6 +1147,7 @@ func (a adminAPIHandlers) SitePerfHandler(w http.ResponseWriter, r *http.Request
writeErrorResponseJSON(ctx, w, errorCodes.ToAPIErr(toAPIErrorCode(ctx, err)), r.URL) writeErrorResponseJSON(ctx, w, errorCodes.ToAPIErr(toAPIErrorCode(ctx, err)), r.URL)
return return
} }
ctx = lkctx.Context()
defer nsLock.Unlock(lkctx) defer nsLock.Unlock(lkctx)
durationStr := r.Form.Get(peerRESTDuration) durationStr := r.Form.Get(peerRESTDuration)
@ -1253,6 +1254,7 @@ func (a adminAPIHandlers) NetperfHandler(w http.ResponseWriter, r *http.Request)
writeErrorResponseJSON(ctx, w, errorCodes.ToAPIErr(toAPIErrorCode(ctx, err)), r.URL) writeErrorResponseJSON(ctx, w, errorCodes.ToAPIErr(toAPIErrorCode(ctx, err)), r.URL)
return return
} }
ctx = lkctx.Context()
defer nsLock.Unlock(lkctx) defer nsLock.Unlock(lkctx)
durationStr := r.Form.Get(peerRESTDuration) durationStr := r.Form.Get(peerRESTDuration)