From 3eaa1f42fe11d2d80cfdc54d1060429b3d0a8fb5 Mon Sep 17 00:00:00 2001 From: Henrik Hautakoski Date: Wed, 2 Feb 2022 15:58:06 +0100 Subject: [PATCH] redis.go: in RedisConnect() do a ping and return any errors. So we know that the connection is up or not. --- redis.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/redis.go b/redis.go index c7d03b2..99de8d3 100644 --- a/redis.go +++ b/redis.go @@ -14,12 +14,14 @@ var redisCtx = context.Background() var redisPrefix = "ship." -func RedisConnect(addr string, password string, db int) { +func RedisConnect(addr string, password string, db int) error { rdb = redis.NewClient(&redis.Options{ Addr: addr, Password: password, DB: db, }) + + return rdb.Ping(redisCtx).Err() } func RedisKey(components ...string) (string) {