Skip to content

Commit

Permalink
etcdserver/api/etcdhttp: health 'false' when kv space is exceeeded
Browse files Browse the repository at this point in the history
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
  • Loading branch information
gyuho committed Jul 17, 2017
1 parent ea0dd6e commit 3e1fa03
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion etcdserver/api/etcdhttp/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,12 @@ func healthHandler(server *etcdserver.EtcdServer) http.HandlerFunc {
http.Error(w, `{"health": "false"}`, http.StatusServiceUnavailable)
return
}
hv := `{"health": "true"}`
if server.GetKVQuota().Remaining() < 1.5*1024*1024 {
hv = `{"health": "false"}`
}
w.WriteHeader(http.StatusOK)
w.Write([]byte(`{"health": "true"}`))
w.Write([]byte(hv))
}
}

Expand Down

0 comments on commit 3e1fa03

Please sign in to comment.