From e66cc0d858e4c0650ce3a0bb99a5fdadfa4cb1a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorben=20G=C3=BCnther?= Date: Mon, 10 Jul 2023 12:20:16 +0200 Subject: [PATCH] cache/redis: Try to ping redis on cache creation Otherwise the bridge would continue to run even if the cache is not available. --- cache/redis.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cache/redis.go b/cache/redis.go index 970130c..3975e71 100644 --- a/cache/redis.go +++ b/cache/redis.go @@ -22,9 +22,13 @@ func NewRedisCache(redisURL string, d time.Duration) (Cache, error) { } rdb := redis.NewClient(ropts) + err = rdb.Ping(context.Background()).Err() + if err != nil { + return nil, err + } + c.client = rdb c.duration = d - return c, nil }