chore: coding style (#4037)

This commit is contained in:
Kevin Wan
2024-04-03 22:55:52 +08:00
committed by GitHub
parent 968727412d
commit 08563482e5
3 changed files with 9 additions and 7 deletions

View File

@@ -13,7 +13,7 @@ import (
var defaultHealthManager = newComboHealthManager()
type (
// Probe represents readiness status of given component.
// Probe represents readiness status of a given component.
Probe interface {
// MarkReady sets a ready state for the endpoint handlers.
MarkReady()
@@ -44,10 +44,10 @@ func AddProbe(probe Probe) {
}
// CreateHttpHandler create health http handler base on given probe.
func CreateHttpHandler(healthRespInfo string) http.HandlerFunc {
func CreateHttpHandler(healthResponse string) http.HandlerFunc {
return func(w http.ResponseWriter, _ *http.Request) {
if defaultHealthManager.IsReady() {
_, _ = w.Write([]byte(healthRespInfo))
_, _ = w.Write([]byte(healthResponse))
} else {
http.Error(w, "Service Unavailable\n"+defaultHealthManager.verboseInfo(),
http.StatusServiceUnavailable)