Fix healthcheck handler to verify gateway backend liveness (#6218)

Fixes #6217
master
Nitish Tiwari 6 years ago committed by kannappanr
parent 264cc4020f
commit 197af49c99
  1. 13
      cmd/healthcheck-handler.go

@ -55,6 +55,19 @@ func LivenessCheckHandler(w http.ResponseWriter, r *http.Request) {
writeResponse(w, http.StatusServiceUnavailable, nil, mimeNone) writeResponse(w, http.StatusServiceUnavailable, nil, mimeNone)
return return
} }
s := objLayer.StorageInfo(ctx)
// Gateways don't provide disk info
if s.Backend.Type == Unknown {
// ListBuckets to confirm gateway backend is up
if _, err := objLayer.ListBuckets(ctx); err != nil {
writeResponse(w, http.StatusServiceUnavailable, nil, mimeNone)
return
}
writeResponse(w, http.StatusOK, nil, mimeNone)
return
}
var totalLocalDisks int var totalLocalDisks int
var erroredDisks int var erroredDisks int
for _, endpoint := range globalEndpoints { for _, endpoint := range globalEndpoints {

Loading…
Cancel
Save