Skip to content

Commit

Permalink
CR's fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
evgeniy-scherbina committed Oct 11, 2023
1 parent 537eb79 commit 305b1c5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions clients/cache/redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
4 changes: 4 additions & 0 deletions service/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit 305b1c5

Please sign in to comment.