This commit is contained in:
@@ -124,7 +124,7 @@ func monitorMemAndQuit() {
|
||||
|
||||
// 4. 超70%阈值,执行优雅退出
|
||||
if usedRatio >= memThresholdRatio {
|
||||
log.Fatalf("内存占比达%.1f%%,超过70%阈值,程序开始退出", usedRatio*100)
|
||||
log.Fatalf("内存占比达%.1f%%,超过90%阈值,程序开始退出", usedRatio*100)
|
||||
// ########## 可选:这里添加你的优雅清理逻辑 ##########
|
||||
// 如:关闭数据库连接、释放文件句柄、保存业务状态、推送退出告警等
|
||||
cleanup()
|
||||
|
||||
@@ -71,6 +71,7 @@ func (h *ClientData) Recv(data common.TomeeHeader) {
|
||||
ptrValue := reflect.New(cmdlister.Req)
|
||||
|
||||
tt1 := ptrValue.Elem().Addr().Interface()
|
||||
|
||||
// fmt.Println(tt1)
|
||||
err := struc.Unpack(bytes.NewBuffer(data.Data), tt1)
|
||||
playerconn, cok := h.Conn.Context().(*ClientData)
|
||||
@@ -79,14 +80,6 @@ func (h *ClientData) Recv(data common.TomeeHeader) {
|
||||
}
|
||||
if err != nil {
|
||||
|
||||
head := common.NewTomeeHeader(1001, data.UserID)
|
||||
|
||||
head.Result = uint32(errorcode.ErrorCodes.ErrIllegalLanguage)
|
||||
|
||||
// 实际上这里有个问题,会造成重复保存问题
|
||||
|
||||
playerconn.SendPack(head.Pack(nil))
|
||||
//h.Conn.Close()
|
||||
cool.Logger.Error(context.Background(), data.UserID, data.CMD, "解包失败,", err)
|
||||
//fmt.Println(data.UserID, data.CMD, "解包失败,", hex.EncodeToString(data.Data))
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user