Jelajahi Sumber

压测提交

liliang 7 bulan lalu
induk
melakukan
0a3ec020d5
3 mengubah file dengan 12 tambahan dan 16 penghapusan
  1. 1 1
      const/const.go
  2. 2 1
      game/config/profile-gc.json
  3. 9 14
      game/game_cluster/internal/mdb/component.go

+ 1 - 1
const/const.go

@@ -5,7 +5,7 @@ import (
 )
 
 const (
-	version = "1.0.20"
+	version = "1.0.21"
 )
 
 var logo = `

+ 2 - 1
game/config/profile-gc.json

@@ -255,7 +255,8 @@
       "subscribe_key": "data_config_change",
       "address": "127.0.0.1:6379",
       "password": "",
-      "db": 7
+      "db": 7,
+      "tls": 0
     }
   }
 }

+ 9 - 14
game/game_cluster/internal/mdb/component.go

@@ -3,7 +3,6 @@ package mdb
 import (
 	"context"
 	"crypto/tls"
-	"fmt"
 	"github.com/go-redis/redis/v8"
 	mhayaMongo "github.com/mhaya/components/mongo"
 	clog "github.com/mhaya/logger"
@@ -40,38 +39,34 @@ func (p *ActorDB) OnInit() {
 	if MDB == nil {
 		clog.Panic("game_db_id not found")
 	}
+
 	redisConfig := cprofile.GetConfig("redis")
 	tlsEnable := redisConfig.GetInt("tls")
+
 	if tlsEnable == 1 {
 		tlsConfig := &tls.Config{
 			MinVersion:               tls.VersionTLS12,
 			PreferServerCipherSuites: true,
 		}
+
 		RDB = redis.NewUniversalClient(&redis.UniversalOptions{
 			Addrs:     strings.Split(redisConfig.GetString("address"), ","),
 			Password:  redisConfig.GetString("password"),
 			DB:        redisConfig.GetInt("db"),
 			TLSConfig: tlsConfig,
 		})
-		clog.Debugf("redis Addrs str: ", redisConfig.GetString("address"), ",")
-		split := strings.Split(redisConfig.GetString("address"), ",")
-		for i := 0; i < len(split); i++ {
-			if i > 0 {
-				fmt.Print(", ")
-			}
-			clog.Debugf("addr : %s", split[i])
-		}
-
-		err := RDB.Set(context.Background(), "test", 0, 0).Err()
-		clog.Errorf("redis client error %v:", err)
 	} else {
 		RDB = redis.NewUniversalClient(&redis.UniversalOptions{
 			Addrs:    strings.Split(redisConfig.GetString("address"), ","),
 			Password: redisConfig.GetString("password"),
 			DB:       redisConfig.GetInt("db"),
 		})
-		err := RDB.Set(context.Background(), "test", 0, 0).Err()
-		clog.Errorf("redis client error %v:", err)
+	}
+
+	clog.Debug("redis address :" + redisConfig.GetString("address"))
+	err := RDB.Set(context.Background(), "test", 0, 0).Err()
+	if err != nil {
+		clog.Errorf("redis client error: %v", err)
 	}
 
 	if p.App().NodeId() == "m-center" {