health handler fix
This commit is contained in:
@@ -12,19 +12,13 @@ type HealthResponse struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *Server) HealthHandler(c *fiber.Ctx) error {
|
func (s *Server) HealthHandler(c *fiber.Ctx) error {
|
||||||
// Only 404 indicate service as non-healthy
|
// Only 404 indicate service as not-healthy
|
||||||
err := s.GetDatabase().Ping(context.Background())
|
err := s.GetDatabase().Ping(context.Background())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// fmt.Println("db unavailable", err)
|
// fmt.Println("db unavailable", err)
|
||||||
return c.SendStatus(http.StatusNotFound)
|
return c.SendStatus(http.StatusNotFound)
|
||||||
}
|
}
|
||||||
|
|
||||||
err = s.GetLogger().Ping()
|
|
||||||
if err != nil {
|
|
||||||
// fmt.Println("logger unavailable", err)
|
|
||||||
return c.SendStatus(http.StatusNotFound)
|
|
||||||
}
|
|
||||||
|
|
||||||
err = s.GetCache().Ping(context.Background()).Err()
|
err = s.GetCache().Ping(context.Background()).Err()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// fmt.Println("cache unavailable", err)
|
// fmt.Println("cache unavailable", err)
|
||||||
|
|||||||
Reference in New Issue
Block a user