mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-06 04:15:46 +08:00
test
This commit is contained in:
parent
4f01b0b2ad
commit
2775d9b78a
@ -3,6 +3,8 @@ package gate
|
||||
import (
|
||||
"Open_IM/pkg/common/config"
|
||||
"Open_IM/pkg/common/log"
|
||||
"Open_IM/pkg/statistics"
|
||||
"fmt"
|
||||
"github.com/go-playground/validator/v10"
|
||||
"sync"
|
||||
)
|
||||
@ -12,6 +14,7 @@ var (
|
||||
validate *validator.Validate
|
||||
ws WServer
|
||||
rpcSvr RPCServer
|
||||
count uint64
|
||||
)
|
||||
|
||||
func Init(rpcPort, wsPort int) {
|
||||
@ -19,6 +22,7 @@ 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)
|
||||
ws.onInit(wsPort)
|
||||
rpcSvr.onInit(rpcPort)
|
||||
}
|
||||
|
@ -142,6 +142,7 @@ func (ws *WServer) pullMsgBySeqListResp(conn *UserConn, m *Req, pb *sdk_ws.PullM
|
||||
|
||||
}
|
||||
func (ws *WServer) sendMsgReq(conn *UserConn, m *Req) {
|
||||
count++
|
||||
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)
|
||||
|
@ -11,7 +11,8 @@ import (
|
||||
"Open_IM/pkg/common/constant"
|
||||
"Open_IM/pkg/common/kafka"
|
||||
"Open_IM/pkg/common/log"
|
||||
"time"
|
||||
"Open_IM/pkg/statistics"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
var (
|
||||
@ -19,6 +20,7 @@ var (
|
||||
pushCh PushConsumerHandler
|
||||
pushTerminal []int32
|
||||
producer *kafka.Producer
|
||||
count uint64
|
||||
)
|
||||
|
||||
func Init(rpcPort int) {
|
||||
@ -29,20 +31,10 @@ func Init(rpcPort int) {
|
||||
}
|
||||
func init() {
|
||||
producer = kafka.NewKafkaProducer(config.Config.Kafka.Ws2mschat.Addr, config.Config.Kafka.Ws2mschat.Topic)
|
||||
statistics.NewStatistics(&count, config.Config.ModuleName.PushName, fmt.Sprintf("%d second push to msg_gateway count", count), 10)
|
||||
}
|
||||
|
||||
func Run() {
|
||||
go rpcServer.run()
|
||||
go pushCh.pushConsumerGroup.RegisterHandleAndConsumer(&pushCh)
|
||||
go stat()
|
||||
}
|
||||
func stat() {
|
||||
t := time.NewTicker(time.Second * 10)
|
||||
defer t.Stop()
|
||||
for {
|
||||
select {
|
||||
case <-t.C:
|
||||
}
|
||||
log.Debug("", "10 second handle msg to mongo is ")
|
||||
}
|
||||
}
|
||||
|
@ -47,6 +47,7 @@ func MsgToUser(pushMsg *pbPush.PushMsgReq) {
|
||||
}
|
||||
}
|
||||
log.InfoByKv("push_result", pushMsg.OperationID, "result", wsResult, "sendData", pushMsg.MsgData)
|
||||
count++
|
||||
//if isOfflinePush && pushMsg.PushToUserID != pushMsg.MsgData.SendID {
|
||||
// for _, v := range wsResult {
|
||||
// if v.ResultCode == 0 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user