Merge pull request #123396 from cyclinder/apiserver_datarace

Fix data race in apiserver mux handler
This commit is contained in:
Kubernetes Prow Robot
2024-04-30 09:24:14 -07:00
committed by GitHub

View File

@@ -96,9 +96,11 @@ func NewPathRecorderMux(name string) *PathRecorderMux {
// ListedPaths returns the registered handler exposedPaths.
func (m *PathRecorderMux) ListedPaths() []string {
m.lock.Lock()
handledPaths := append([]string{}, m.exposedPaths...)
sort.Strings(handledPaths)
m.lock.Unlock()
sort.Strings(handledPaths)
return handledPaths
}