From fb046dadf865274db0d0fe8e346bee6ef048ca47 Mon Sep 17 00:00:00 2001 From: "pakintada@gmail.com" Date: Thu, 8 Feb 2024 13:58:11 +0700 Subject: [PATCH] fix handle error redis --- server/data/redis.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/data/redis.go b/server/data/redis.go index 865de1f..c4cf2c9 100644 --- a/server/data/redis.go +++ b/server/data/redis.go @@ -26,7 +26,7 @@ func NewRedisClient(address, password string) *RedisCli { client := redis.NewClient(&options) - if err := client.Ping(context.Background()); err != nil { + if err := client.Ping(context.Background()); err.Err() != nil { fmt.Println("trying localhost ...", err) client = redis.NewClient(&redis.Options{ Addr: "localhost:6379", @@ -34,7 +34,7 @@ func NewRedisClient(address, password string) *RedisCli { DB: 0, }) - if err_local := client.Ping(context.Background()); err_local != nil { + if err_local := client.Ping(context.Background()); err_local.Err() != nil { fmt.Println("> result ====> ", err_local) // do as warning } else {