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:
parent
dc9078c3f5
commit
e66cc0d858
1 changed files with 5 additions and 1 deletions
6
cache/redis.go
vendored
6
cache/redis.go
vendored
|
@ -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
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue