readiness: fix data race
Change-Id: If548f2b28d4ebaaa7d5a2127f684371fad6c2451
This commit is contained in:
parent
e58730168d
commit
07106497f1
|
@ -49,6 +49,7 @@ func Handler(w http.ResponseWriter, r *http.Request) {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mu.Lock()
|
||||||
for k, v := range registry {
|
for k, v := range registry {
|
||||||
_, err = fmt.Fprintln(resp, fmt.Sprintf("%s\t%v", k, v))
|
_, err = fmt.Fprintln(resp, fmt.Sprintf("%s\t%v", k, v))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -59,6 +60,7 @@ func Handler(w http.ResponseWriter, r *http.Request) {
|
||||||
ready = false
|
ready = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
mu.Unlock()
|
||||||
|
|
||||||
if !ready {
|
if !ready {
|
||||||
w.WriteHeader(http.StatusPreconditionFailed)
|
w.WriteHeader(http.StatusPreconditionFailed)
|
||||||
|
|
Loading…
Reference in New Issue