From 305b1c5be7c8ba7c5c7a2252d8044fcd036b31e2 Mon Sep 17 00:00:00 2001 From: evgeniy-scherbina Date: Wed, 11 Oct 2023 15:56:16 -0400 Subject: [PATCH] CR's fixes --- clients/cache/redis.go | 5 +++++ service/handlers.go | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/clients/cache/redis.go b/clients/cache/redis.go index fd850ca..f5bc604 100644 --- a/clients/cache/redis.go +++ b/clients/cache/redis.go @@ -102,8 +102,13 @@ func (rc *RedisCache) Healthcheck(ctx context.Context) error { // Check if we can connect to Redis _, err := rc.client.Ping(ctx).Result() if err != nil { + rc.Logger.Error(). + Err(err). + Msg("can't ping redis") return fmt.Errorf("error connecting to Redis: %v", err) } + rc.Logger.Trace().Msg("redis healthcheck was successful") + return nil } diff --git a/service/handlers.go b/service/handlers.go index c615b03..5e778bf 100644 --- a/service/handlers.go +++ b/service/handlers.go @@ -28,6 +28,10 @@ func createHealthcheckHandler(service *ProxyService) func(http.ResponseWriter, * err = service.Cache.Healthcheck(context.Background()) if err != nil { + service.Logger.Error(). + Err(err). + Msg("cache healthcheck failed") + errMsg := fmt.Errorf("proxy service unable to connect to cache") combinedErrors = errors.Join(combinedErrors, errMsg) }