goproxy icon indicating copy to clipboard operation
goproxy copied to clipboard

Thread safety when update the registry

Open chrislee87 opened this issue 7 years ago • 0 comments

if err != nil {
        reg.Failure(serviceName, serviceVersion, endpoint, err)
        // Failure: remove the endpoint from the current list and try again.
        endpoints = append(endpoints[:i], endpoints[i+1:]...)
        continue
}

This is thread unsafe, the modification of the slice should be placed inside reg.Failure and be protected by lock.

chrislee87 avatar Jul 07 '17 08:07 chrislee87