Newer
Older
"context"
"fmt"
"net/http"
"time"
"github.com/prometheus/client_golang/prometheus/promhttp"
func stopHttpServer() error {
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
log.Info("shutting down http server")
return c.httpServer.Shutdown(ctx)
}
defer func() {
if r := recover(); r != nil {
fmt.Println("Recovered in f", r)
}
}()
http.HandleFunc("/livez", healthCheck)
c.httpServer = &http.Server{Addr: ":8080"}
func healthCheck(writer http.ResponseWriter, request *http.Request) {
writer.WriteHeader(http.StatusOK)
}
func readynessCheck(writer http.ResponseWriter, request *http.Request) {
writer.WriteHeader(http.StatusOK)
}