完善了服务器上下线,http登录负载均衡下发gate地址

This commit is contained in:
flswld
2022-12-24 16:52:08 +08:00
parent 7e86669628
commit f4614b3df6
16 changed files with 569 additions and 119 deletions

View File

@@ -24,6 +24,7 @@ import (
)
var APPID string
var GSID uint32
func Run(ctx context.Context, configFile string) error {
config.InitConfig(configFile)
@@ -42,9 +43,16 @@ func Run(ctx context.Context, configFile string) error {
return err
}
APPID = rsp.GetAppId()
GSID = rsp.GetGsId()
defer func() {
_, _ = client.Discovery.CancelServer(context.TODO(), &api.CancelServerReq{
ServerType: api.GS,
AppId: APPID,
})
}()
logger.InitLogger("gs_" + APPID)
logger.Warn("gs start, appid: %v", APPID)
logger.Warn("gs start, appid: %v, gsid: %v", APPID, GSID)
constant.InitConstant()
@@ -60,7 +68,7 @@ func Run(ctx context.Context, configFile string) error {
messageQueue := mq.NewMessageQueue(api.GS, APPID)
defer messageQueue.Close()
gameManager := game.NewGameManager(db, messageQueue)
gameManager := game.NewGameManager(db, messageQueue, GSID)
defer gameManager.Stop()
// natsrpc server