cache/redis: Try to ping redis on cache creation

Otherwise the bridge would continue to run even if the cache is not
available.
This commit is contained in:
Thorben Günther 2023-07-10 12:20:16 +02:00
parent dc9078c3f5
commit e66cc0d858
No known key found for this signature in database
GPG key ID: 415CD778D8C5AFED

6
cache/redis.go vendored
View file

@ -22,9 +22,13 @@ func NewRedisCache(redisURL string, d time.Duration) (Cache, error) {
} }
rdb := redis.NewClient(ropts) rdb := redis.NewClient(ropts)
err = rdb.Ping(context.Background()).Err()
if err != nil {
return nil, err
}
c.client = rdb c.client = rdb
c.duration = d c.duration = d
return c, nil return c, nil
} }