Merge branch 'tuoyun' of github.com:OpenIMSDK/Open-IM-Server into tuoyun

This commit is contained in:
wangchuxiao 2022-05-25 17:39:42 +08:00
commit 3f76521bfe
2 changed files with 8 additions and 2 deletions

View File

@ -164,7 +164,7 @@ func (och *OnlineHistoryConsumerHandler) SendMessageToMongoCH(userID string, tri
func (och *OnlineHistoryConsumerHandler) MongoMessageRun(channelID int) {
for {
select {
case cmd := <-och.chArrays[channelID]:
case cmd := <-och.chMongoArrays[channelID]:
switch cmd.Cmd {
case MongoMessages:
msgChannelValue := cmd.Value.(MsgChannelValue)

View File

@ -17,6 +17,7 @@ import (
"Open_IM/pkg/utils"
"context"
"encoding/json"
"google.golang.org/grpc"
"strings"
)
@ -32,11 +33,16 @@ type AtContent struct {
IsAtSelf bool `json:"isAtSelf"`
}
var grpcCons []*grpc.ClientConn
func MsgToUser(pushMsg *pbPush.PushMsgReq) {
var wsResult []*pbRelay.SingleMsgToUser
isOfflinePush := utils.GetSwitchFromOptions(pushMsg.MsgData.Options, constant.IsOfflinePush)
log.Debug(pushMsg.OperationID, "Get msg from msg_transfer And push msg", pushMsg.String())
grpcCons := getcdv3.GetConn4Unique(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOnlineMessageRelayName)
if len(grpcCons) == 0 {
log.NewWarn(pushMsg.OperationID, "first GetConn4Unique ")
grpcCons = getcdv3.GetConn4Unique(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOnlineMessageRelayName)
}
//Online push message
log.Debug("test", pushMsg.OperationID, "len grpc", len(grpcCons), "data", pushMsg.String())
for _, v := range grpcCons {