From 554e1f5e8167ccf2bb91b796f5ffc2369f598908 Mon Sep 17 00:00:00 2001 From: "Jibon L. Costa" Date: Fri, 27 Dec 2024 15:17:08 +0100 Subject: [PATCH] fix: use `StatusServiceUnavailable` --- pkg/controllers/health_check.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/controllers/health_check.go b/pkg/controllers/health_check.go index 0f5ab82f..20011561 100644 --- a/pkg/controllers/health_check.go +++ b/pkg/controllers/health_check.go @@ -9,20 +9,20 @@ import ( func HandleHealthCheck(c *fiber.Ctx) error { db, err := config.GetConfig().DB.DB() if err != nil { - return c.Status(fiber.StatusInternalServerError).SendString("DB connection error") + return c.Status(fiber.StatusServiceUnavailable).SendString("DB connection error") } err = db.Ping() if err != nil { - return c.Status(fiber.StatusInternalServerError).SendString("DB connection error") + return c.Status(fiber.StatusServiceUnavailable).SendString("DB connection error") } _, err = config.GetConfig().RDS.Ping(context.Background()).Result() if err != nil { - return c.Status(fiber.StatusInternalServerError).SendString("Redis connection error") + return c.Status(fiber.StatusServiceUnavailable).SendString("Redis connection error") } if !config.GetConfig().NatsConn.IsConnected() { - return c.Status(fiber.StatusInternalServerError).SendString("Nats connection error") + return c.Status(fiber.StatusServiceUnavailable).SendString("Nats connection error") } return c.Status(fiber.StatusOK).SendString("Healthy")