From e2f7dd67a20e17f7a31c22fbfac2322ea41b224b Mon Sep 17 00:00:00 2001 From: Gordon <1432970085@qq.com> Date: Thu, 16 Jun 2022 15:29:48 +0800 Subject: [PATCH] add global recv opt --- pkg/common/db/model.go | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/pkg/common/db/model.go b/pkg/common/db/model.go index bc8af133d..b4b77ecc2 100644 --- a/pkg/common/db/model.go +++ b/pkg/common/db/model.go @@ -28,7 +28,7 @@ type DataBases struct { mgoSession *mgo.Session //redisPool *redis.Pool mongoClient *mongo.Client - rdb go_redis.UniversalClient + rdb *go_redis.ClusterClient } type RedisClient struct { @@ -130,18 +130,19 @@ func init() { if err != nil { panic(err.Error()) } - } else { - DB.rdb = go_redis.NewClient(&go_redis.Options{ - Addr: config.Config.Redis.DBAddress, - Password: config.Config.Redis.DBPassWord, // no password set - DB: 0, // use default DB - PoolSize: 100, // 连接池大小 - }) - _, err = DB.rdb.Ping(ctx).Result() - if err != nil { - panic(err.Error()) - } } + //} else { + // DB.rdb = go_redis.NewClient(&go_redis.Options{ + // Addr: config.Config.Redis.DBAddress, + // Password: config.Config.Redis.DBPassWord, // no password set + // DB: 0, // use default DB + // PoolSize: 100, // 连接池大小 + // }) + // _, err = DB.rdb.Ping(ctx).Result() + // if err != nil { + // panic(err.Error()) + // } + //} } func createMongoIndex(client *mongo.Client, collection string, isUnique bool, keys ...string) error {