From 1b457b0be69826da84af6029fab85e8703c2f216 Mon Sep 17 00:00:00 2001 From: wenxu12345 <44203734@qq.com> Date: Fri, 18 Mar 2022 11:10:06 +0800 Subject: [PATCH] fix bug : etcd Put failed etcdserver: requested lease not found --- .../msg_transfer/logic/history_msg_handler.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/internal/msg_transfer/logic/history_msg_handler.go b/internal/msg_transfer/logic/history_msg_handler.go index 1281b1732..7d729f5cd 100644 --- a/internal/msg_transfer/logic/history_msg_handler.go +++ b/internal/msg_transfer/logic/history_msg_handler.go @@ -38,15 +38,15 @@ func (mc *HistoryConsumerHandler) Init() { } func (mc *HistoryConsumerHandler) handleChatWs2Mongo(msg []byte, msgKey string) { - log.NewInfo("msg come mongo!!!", "", "msg", string(msg)) time := utils.GetCurrentTimestampByNano() msgFromMQ := pbMsg.MsgDataToMQ{} err := proto.Unmarshal(msg, &msgFromMQ) if err != nil { - log.ErrorByKv("msg_transfer Unmarshal msg err", "", "msg", string(msg), "err", err.Error()) + log.Error("msg_transfer Unmarshal msg err", "", "msg", string(msg), "err", err.Error()) return } operationID := msgFromMQ.OperationID + log.NewInfo(operationID, "msg come mongo!!!", "", "msg", string(msg)) //Control whether to store offline messages (mongo) isHistory := utils.GetSwitchFromOptions(msgFromMQ.MsgData.Options, constant.IsHistory) //Control whether to store history messages (mysql) @@ -99,28 +99,28 @@ func (mc *HistoryConsumerHandler) ConsumeClaim(sess sarama.ConsumerGroupSession, return nil } func sendMessageToPush(message *pbMsg.MsgDataToMQ, pushToUserID string) { - log.InfoByKv("msg_transfer send message to push", message.OperationID, "message", message.String()) + log.Info(message.OperationID, "msg_transfer send message to push", "message", message.String()) rpcPushMsg := pbPush.PushMsgReq{OperationID: message.OperationID, MsgData: message.MsgData, PushToUserID: pushToUserID} mqPushMsg := pbMsg.PushMsgDataToMQ{OperationID: message.OperationID, MsgData: message.MsgData, PushToUserID: pushToUserID} grpcConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImPushName) if grpcConn == nil { - log.ErrorByKv("rpc dial failed", rpcPushMsg.OperationID, "push data", rpcPushMsg.String()) + log.Error(rpcPushMsg.OperationID, "rpc dial failed", "push data", rpcPushMsg.String()) pid, offset, err := producer.SendMessage(&mqPushMsg) if err != nil { - log.ErrorByKv("kafka send failed", mqPushMsg.OperationID, "send data", message.String(), "pid", pid, "offset", offset, "err", err.Error()) + log.Error(mqPushMsg.OperationID, "kafka send failed", "send data", message.String(), "pid", pid, "offset", offset, "err", err.Error()) } return } msgClient := pbPush.NewPushMsgServiceClient(grpcConn) _, err := msgClient.PushMsg(context.Background(), &rpcPushMsg) if err != nil { - log.ErrorByKv("rpc send failed", rpcPushMsg.OperationID, "push data", rpcPushMsg.String(), "err", err.Error()) + log.Error(rpcPushMsg.OperationID, "rpc send failed", rpcPushMsg.OperationID, "push data", rpcPushMsg.String(), "err", err.Error()) pid, offset, err := producer.SendMessage(&mqPushMsg) if err != nil { - log.ErrorByKv("kafka send failed", mqPushMsg.OperationID, "send data", mqPushMsg.String(), "pid", pid, "offset", offset, "err", err.Error()) + log.Error("kafka send failed", mqPushMsg.OperationID, "send data", mqPushMsg.String(), "pid", pid, "offset", offset, "err", err.Error()) } } else { - log.InfoByKv("rpc send success", rpcPushMsg.OperationID, "push data", rpcPushMsg.String()) + log.Info("rpc send success", rpcPushMsg.OperationID, "push data", rpcPushMsg.String()) } }