mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-23 09:50:27 +08:00
Merge branch 'tuoyun' of github.com:OpenIMSDK/Open-IM-Server into tuoyun
This commit is contained in:
commit
48f03f306a
@ -182,7 +182,7 @@ func (ws *WServer) addUserConn(uid string, platformID int32, conn *UserConn, tok
|
|||||||
for _, v := range ws.wsUserToConn {
|
for _, v := range ws.wsUserToConn {
|
||||||
count = count + len(v)
|
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)
|
log.Debug("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))
|
userCount = uint64(len(ws.wsUserToConn))
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -31,10 +31,10 @@ type AtContent struct {
|
|||||||
func MsgToUser(pushMsg *pbPush.PushMsgReq) {
|
func MsgToUser(pushMsg *pbPush.PushMsgReq) {
|
||||||
var wsResult []*pbRelay.SingleMsgToUser
|
var wsResult []*pbRelay.SingleMsgToUser
|
||||||
//isOfflinePush := utils.GetSwitchFromOptions(pushMsg.MsgData.Options, constant.IsOfflinePush)
|
//isOfflinePush := utils.GetSwitchFromOptions(pushMsg.MsgData.Options, constant.IsOfflinePush)
|
||||||
log.InfoByKv("Get msg from msg_transfer And push msg", pushMsg.OperationID, "PushData", pushMsg.String())
|
log.Debug("Get msg from msg_transfer And push msg", pushMsg.OperationID, "PushData", pushMsg.String())
|
||||||
grpcCons := getcdv3.GetConn4Unique(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOnlineMessageRelayName)
|
grpcCons := getcdv3.GetConn4Unique(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOnlineMessageRelayName)
|
||||||
//Online push message
|
//Online push message
|
||||||
log.InfoByKv("test", pushMsg.OperationID, "len grpc", len(grpcCons), "data", pushMsg.String())
|
log.Debug("test", pushMsg.OperationID, "len grpc", len(grpcCons), "data", pushMsg.String())
|
||||||
for _, v := range grpcCons {
|
for _, v := range grpcCons {
|
||||||
msgClient := pbRelay.NewOnlineMessageRelayServiceClient(v)
|
msgClient := pbRelay.NewOnlineMessageRelayServiceClient(v)
|
||||||
reply, err := msgClient.OnlinePushMsg(context.Background(), &pbRelay.OnlinePushMsgReq{OperationID: pushMsg.OperationID, MsgData: pushMsg.MsgData, PushToUserID: pushMsg.PushToUserID})
|
reply, err := msgClient.OnlinePushMsg(context.Background(), &pbRelay.OnlinePushMsgReq{OperationID: pushMsg.OperationID, MsgData: pushMsg.MsgData, PushToUserID: pushMsg.PushToUserID})
|
||||||
|
@ -126,14 +126,14 @@ func (rpc *rpcChat) SendMsg(_ context.Context, pb *pbChat.SendMsgReq) (*pbChat.S
|
|||||||
}
|
}
|
||||||
|
|
||||||
// callback
|
// callback
|
||||||
canSend, err := callBackWordFilter(pb)
|
//canSend, err := callBackWordFilter(pb)
|
||||||
if err != nil {
|
//if err != nil {
|
||||||
log.NewError(pb.OperationID, utils.GetSelfFuncName(), "CallbackBeforeSendMsg failed", err.Error(), pb.MsgData)
|
// log.NewError(pb.OperationID, utils.GetSelfFuncName(), "CallbackBeforeSendMsg failed", err.Error(), pb.MsgData)
|
||||||
}
|
//}
|
||||||
if !canSend {
|
//if !canSend {
|
||||||
log.NewDebug(pb.OperationID, utils.GetSelfFuncName(), "callback result", canSend, "end rpc and return", pb.MsgData)
|
// log.NewDebug(pb.OperationID, utils.GetSelfFuncName(), "callback result", canSend, "end rpc and return", pb.MsgData)
|
||||||
return returnMsg(&replay, pb, 201, "callback result stop rpc and return", "", 0)
|
// return returnMsg(&replay, pb, 201, "callback result stop rpc and return", "", 0)
|
||||||
}
|
//}
|
||||||
switch pb.MsgData.SessionType {
|
switch pb.MsgData.SessionType {
|
||||||
case constant.SingleChatType:
|
case constant.SingleChatType:
|
||||||
canSend, err := callbackBeforeSendSingleMsg(pb)
|
canSend, err := callbackBeforeSendSingleMsg(pb)
|
||||||
|
@ -62,4 +62,5 @@ func PostReturn(url string, input, output interface{}, timeOut int) error {
|
|||||||
if err = json.Unmarshal(b, output); err != nil {
|
if err = json.Unmarshal(b, output); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package log
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/pkg/common/config"
|
"Open_IM/pkg/common/config"
|
||||||
|
"bufio"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"time"
|
"time"
|
||||||
@ -32,13 +33,13 @@ func loggerInit(moduleName string) *Logger {
|
|||||||
//All logs will be printed
|
//All logs will be printed
|
||||||
logger.SetLevel(logrus.Level(config.Config.Log.RemainLogLevel))
|
logger.SetLevel(logrus.Level(config.Config.Log.RemainLogLevel))
|
||||||
//Close std console output
|
//Close std console output
|
||||||
//src, err := os.OpenFile(os.DevNull, os.O_APPEND|os.O_WRONLY, os.ModeAppend)
|
src, err := os.OpenFile(os.DevNull, os.O_APPEND|os.O_WRONLY, os.ModeAppend)
|
||||||
//if err != nil {
|
if err != nil {
|
||||||
// panic(err.Error())
|
panic(err.Error())
|
||||||
//}
|
}
|
||||||
//writer := bufio.NewWriter(src)
|
writer := bufio.NewWriter(src)
|
||||||
//logger.SetOutput(writer)
|
logger.SetOutput(writer)
|
||||||
logger.SetOutput(os.Stdout)
|
//logger.SetOutput(os.Stdout)
|
||||||
//Log Console Print Style Setting
|
//Log Console Print Style Setting
|
||||||
logger.SetFormatter(&nested.Formatter{
|
logger.SetFormatter(&nested.Formatter{
|
||||||
TimestampFormat: "2006-01-02 15:04:05.000",
|
TimestampFormat: "2006-01-02 15:04:05.000",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user