goproxy
goproxy copied to clipboard
Thread safety when update the registry
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.