diff --git a/internal/api/third/minio_init.go b/internal/api/third/minio_init.go index d073524f3..9d5e404de 100644 --- a/internal/api/third/minio_init.go +++ b/internal/api/third/minio_init.go @@ -45,7 +45,7 @@ func init() { //err = minioClient.SetBucketPolicy(context.Background(), config.Config.Credential.Minio.Bucket, policy.BucketPolicyReadWrite) //if err != nil { // log.NewError("", utils.GetSelfFuncName(), "SetBucketPolicy failed please set in ", err.Error()) - // return + // return`z //} log.NewInfo("", utils.GetSelfFuncName(), "minio create and set policy success") } diff --git a/internal/msg_gateway/gate/init.go b/internal/msg_gateway/gate/init.go index 47d1dcedb..a98027561 100644 --- a/internal/msg_gateway/gate/init.go +++ b/internal/msg_gateway/gate/init.go @@ -10,11 +10,12 @@ import ( ) var ( - rwLock *sync.RWMutex - validate *validator.Validate - ws WServer - rpcSvr RPCServer - count uint64 + rwLock *sync.RWMutex + validate *validator.Validate + ws WServer + rpcSvr RPCServer + sendMsgCount uint64 + userCount uint64 ) func Init(rpcPort, wsPort int) { @@ -22,7 +23,8 @@ func Init(rpcPort, wsPort int) { log.NewPrivateLog(config.Config.ModuleName.LongConnSvrName) rwLock = new(sync.RWMutex) validate = validator.New() - statistics.NewStatistics(&count, config.Config.ModuleName.LongConnSvrName, fmt.Sprintf("%d second recv to msg_gateway count", count), 10) + statistics.NewStatistics(&sendMsgCount, config.Config.ModuleName.LongConnSvrName, fmt.Sprintf("%d second recv to msg_gateway sendMsgCount", sendMsgCount), 10) + statistics.NewStatistics(&userCount, config.Config.ModuleName.LongConnSvrName, fmt.Sprintf("%d second add user conn", userCount), 10) ws.onInit(wsPort) rpcSvr.onInit(rpcPort) } diff --git a/internal/msg_gateway/gate/logic.go b/internal/msg_gateway/gate/logic.go index 2aa19f609..df3b1a356 100644 --- a/internal/msg_gateway/gate/logic.go +++ b/internal/msg_gateway/gate/logic.go @@ -142,7 +142,7 @@ func (ws *WServer) pullMsgBySeqListResp(conn *UserConn, m *Req, pb *sdk_ws.PullM } func (ws *WServer) sendMsgReq(conn *UserConn, m *Req) { - count++ + sendMsgCount++ log.NewInfo(m.OperationID, "Ws call success to sendMsgReq start", m.MsgIncr, m.ReqIdentifier, m.SendID) nReply := new(pbChat.SendMsgResp) isPass, errCode, errMsg, pData := ws.argsValidate(m, constant.WSSendMsg) diff --git a/internal/msg_gateway/gate/ws_server.go b/internal/msg_gateway/gate/ws_server.go index 2197fbbc2..ba14561ef 100644 --- a/internal/msg_gateway/gate/ws_server.go +++ b/internal/msg_gateway/gate/ws_server.go @@ -184,6 +184,7 @@ func (ws *WServer) addUserConn(uid string, platformID int32, conn *UserConn, tok count = count + len(v) } log.WarnByKv("WS Add operation", "", "wsUser added", ws.wsUserToConn, "connection_uid", uid, "connection_platform", constant.PlatformIDToName(platformID), "online_user_num", len(ws.wsUserToConn), "online_conn_num", count) + userCount = uint64(len(ws.wsUserToConn)) } @@ -210,6 +211,7 @@ func (ws *WServer) delUserConn(conn *UserConn) { } else { log.WarnByKv("WS delete operation", "", "wsUser deleted", ws.wsUserToConn, "disconnection_uid", uid, "disconnection_platform", platform, "online_user_num", len(ws.wsUserToConn)) } + userCount = uint64(len(ws.wsUserToConn)) delete(ws.wsConnToUser, conn) }