修复:降低聊天同步日志噪声
This commit is contained in:
1 parent
441781dc8e
commit
15019b524a
3 files changed
+4
-4
No files matched your search
@@ -40,7 +40,7 @@ func (a *Adapter) HandleChatMessage(ctx context.Context, message engine.ChatMess
|
||||
BuyerName: message.SenderName, Text: message.Text, MessageID: message.MessageID, ItemID: message.ItemID, Raw: message.Raw,
|
||||
})
|
||||
if stored != nil {
|
||||
a.logger.Info("实时聊天消息已入库", "account", message.AccountID, "chat_id", message.ChatID,
|
||||
a.logger.Debug("实时聊天消息已入库", "account", message.AccountID, "chat_id", message.ChatID,
|
||||
"message_key", stored.MessageKey, "message_type", stored.MessageType, "inserted", inserted)
|
||||
}
|
||||
return err
|
||||
|
||||
@@ -305,7 +305,7 @@ func (s *Server) markChatRead(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
// sess 保存当前认证用户,用于本地未读状态归属隔离。
|
||||
sess := auth.SessionFromContext(r.Context())
|
||||
slog.Info("收到聊天已读请求", "account", input.AccountID, "chat_id", input.ChatID, "message_count", len(input.MessageIDs))
|
||||
slog.Debug("收到聊天已读请求", "account", input.AccountID, "chat_id", input.ChatID, "message_count", len(input.MessageIDs))
|
||||
if len(input.MessageIDs) == 0 {
|
||||
// page 保存应用层返回的本地消息页,只含非敏感字段。
|
||||
page, listErr := s.chatApplication().ListStoredMessages(r.Context(), sess.UserID, input.AccountID, input.ChatID, 0, 200)
|
||||
|
||||
@@ -164,7 +164,7 @@ func (c *Conn) MarkChatRead(ctx context.Context, cid string, messageIDs []map[st
|
||||
ids = append(ids, id)
|
||||
}
|
||||
}
|
||||
c.logger.Info("准备上报闲鱼已读", "cid", cid, "message_count", len(ids), "message_ids", ids)
|
||||
c.logger.Debug("准备上报闲鱼已读", "cid", cid, "message_count", len(ids), "message_ids", ids)
|
||||
// response 保存平台响应;err 表示请求或传输失败。服务只接受一个 string 列表参数。
|
||||
response, err := c.request(ctx, "/r/MessageStatus/read", map[string]any{}, []any{ids}, regResponseTimeout)
|
||||
if err == nil {
|
||||
@@ -172,7 +172,7 @@ func (c *Conn) MarkChatRead(ctx context.Context, cid string, messageIDs []map[st
|
||||
if code, ok := responseCode(response["code"]); ok && code >= 400 {
|
||||
c.logger.Warn("闲鱼已读上报被拒绝", "cid", cid, "message_count", len(ids), "code", code, "body", response["body"])
|
||||
} else {
|
||||
c.logger.Info("闲鱼已读上报成功", "cid", cid, "message_count", len(ids), "message_ids", ids, "code", response["code"])
|
||||
c.logger.Debug("闲鱼已读上报成功", "cid", cid, "message_count", len(ids), "message_ids", ids, "code", response["code"])
|
||||
}
|
||||
}
|
||||
return err
|
||||
|
||||
Reference in new issue
Block a user