mirror of
https://github.com/eosswedenorg/thalos
synced 2026-07-04 12:03:41 +02:00
redis.go: in RedisConnect() do a ping and return any errors. So we know that the connection is up or not.
This commit is contained in:
parent
c1264b2dc1
commit
3eaa1f42fe
1 changed files with 3 additions and 1 deletions
4
redis.go
4
redis.go
|
|
@ -14,12 +14,14 @@ var redisCtx = context.Background()
|
||||||
|
|
||||||
var redisPrefix = "ship."
|
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{
|
rdb = redis.NewClient(&redis.Options{
|
||||||
Addr: addr,
|
Addr: addr,
|
||||||
Password: password,
|
Password: password,
|
||||||
DB: db,
|
DB: db,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
return rdb.Ping(redisCtx).Err()
|
||||||
}
|
}
|
||||||
|
|
||||||
func RedisKey(components ...string) (string) {
|
func RedisKey(components ...string) (string) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue