优化服务器之间的底层连接方式

This commit is contained in:
flswld
2023-01-08 22:11:14 +08:00
parent 99408a745f
commit 6779ed8f20
21 changed files with 742 additions and 216 deletions

View File

@@ -40,10 +40,13 @@ func Run(ctx context.Context, configFile string) error {
ticker := time.NewTicker(time.Second * 15)
for {
<-ticker.C
_, _ = client.Discovery.KeepaliveServer(context.TODO(), &api.KeepaliveServerReq{
_, err := client.Discovery.KeepaliveServer(context.TODO(), &api.KeepaliveServerReq{
ServerType: api.FIGHT,
AppId: APPID,
})
if err != nil {
logger.Error("keepalive error: %v", err)
}
}
}()
defer func() {
@@ -58,7 +61,7 @@ func Run(ctx context.Context, configFile string) error {
constant.InitConstant()
messageQueue := mq.NewMessageQueue(api.FIGHT, APPID)
messageQueue := mq.NewMessageQueue(api.FIGHT, APPID, client)
defer messageQueue.Close()
_ = engine.NewFightEngine(messageQueue)