From aad503e282ffbc73b530e317c80b473aeee92422 Mon Sep 17 00:00:00 2001 From: hokamsingh Date: Wed, 28 Aug 2024 17:20:05 +0530 Subject: [PATCH] feat: updates --- internal/core/middleware/ratelimiter.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/internal/core/middleware/ratelimiter.go b/internal/core/middleware/ratelimiter.go index 3051f24..70ac009 100644 --- a/internal/core/middleware/ratelimiter.go +++ b/internal/core/middleware/ratelimiter.go @@ -2,6 +2,7 @@ package middleware import ( "context" + "log" "net/http" "strconv" "sync" @@ -79,10 +80,15 @@ func NewRateLimiter(limiterType RateLimiterType, config interface{}) *RateLimite return rl case RedisBacked: + ctx := context.Background() cfg := config.(RedisConfig) client := redis.NewClient(&redis.Options{ Addr: cfg.Addr, }) + _, err := client.Ping(ctx).Result() + if err != nil { + log.Fatalf("Could not connect to Redis: %v", err) + } return &RateLimiter{ limiterType: RedisBacked, limit: cfg.Limit,