Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove send time and void client messages sort incorrect. #377

Merged
merged 7 commits into from
Oct 18, 2023
6 changes: 4 additions & 2 deletions internal/conversation_msg/create_message.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,8 @@ func (c *Conversation) CreateAdvancedQuoteMessage(ctx context.Context, text stri
return &s, nil
}

func (c *Conversation) CreateCardMessage(ctx context.Context, card *sdk_struct.CardElem) (*sdk_struct.MsgStruct, error) {
func (c *Conversation) CreateCardMessage(ctx context.Context, card *sdk_struct.CardElem) (*sdk_struct.MsgStruct,
error) {
s := sdk_struct.MsgStruct{}
err := c.initBasicInfo(ctx, &s, constant.UserMsgType, constant.Card)
if err != nil {
Expand All @@ -152,7 +153,8 @@ func (c *Conversation) CreateCardMessage(ctx context.Context, card *sdk_struct.C
return &s, nil
}

func (c *Conversation) CreateVideoMessageFromFullPath(ctx context.Context, videoFullPath string, videoType string, duration int64, snapshotFullPath string) (*sdk_struct.MsgStruct, error) {
func (c *Conversation) CreateVideoMessageFromFullPath(ctx context.Context, videoFullPath string, videoType string,
duration int64, snapshotFullPath string) (*sdk_struct.MsgStruct, error) {
dstFile := utils.FileTmpPath(videoFullPath, c.DataDir) //a->b
written, err := utils.CopyFile(videoFullPath, dstFile)
if err != nil {
Expand Down
11 changes: 7 additions & 4 deletions internal/conversation_msg/message_check.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,13 @@ func (c *Conversation) getMaxAndMinHaveSeqList(messages []*model_struct.LocalCha
// 1、保证单次拉取消息量低于sdk单次从服务器拉取量
// 2、块中连续性检测
// 3、块之间连续性检测
func (c *Conversation) pullMessageAndReGetHistoryMessages(ctx context.Context, conversationID string, seqList []int64, notStartTime,
isReverse bool, count int, startTime int64, list *[]*model_struct.LocalChatLog, messageListCallback *sdk.GetAdvancedHistoryMessageListCallback) {
func (c *Conversation) pullMessageAndReGetHistoryMessages(ctx context.Context, conversationID string, seqList []int64,
notStartTime, isReverse bool, count int, startTime int64, list *[]*model_struct.LocalChatLog,
messageListCallback *sdk.GetAdvancedHistoryMessageListCallback) {
existedSeqList, err := c.db.GetAlreadyExistSeqList(ctx, conversationID, seqList)
if err != nil {
log.ZError(ctx, "GetAlreadyExistSeqList err", err, "conversationID", conversationID, "seqList", seqList)
log.ZError(ctx, "GetAlreadyExistSeqList err", err, "conversationID", conversationID,
"seqList", seqList)
return
}
if len(existedSeqList) == len(seqList) {
Expand All @@ -159,7 +161,8 @@ func (c *Conversation) pullMessageAndReGetHistoryMessages(ctx context.Context, c
}
newSeqList := utils.DifferenceSubset(seqList, existedSeqList)
if len(newSeqList) == 0 {
log.ZDebug(ctx, "do not pull message", "seqList", seqList, "existedSeqList", existedSeqList, "newSeqList", newSeqList)
log.ZDebug(ctx, "do not pull message", "seqList", seqList, "existedSeqList", existedSeqList,
"newSeqList", newSeqList)
return
}
var pullMsgResp sdkws.PullMessageBySeqsResp
Expand Down
1 change: 0 additions & 1 deletion internal/conversation_msg/sdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -1092,7 +1092,6 @@ func (c *Conversation) SetMessageLocalEx(ctx context.Context, conversationID str

func (c *Conversation) initBasicInfo(ctx context.Context, message *sdk_struct.MsgStruct, msgFrom, contentType int32) error {
message.CreateTime = utils.GetCurrentTimestampByMill()
message.SendTime = message.CreateTime
message.IsRead = false
message.Status = constant.MsgStatusSending
message.SendID = c.loginUserID
Expand Down
2 changes: 1 addition & 1 deletion internal/group/group.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func (g *Group) initSyncer() {
}
return g.db.DeleteGroup(ctx, value.GroupID)
}, func(ctx context.Context, server, local *model_struct.LocalGroup) error {
log.ZInfo(ctx, "groupSyncer trigger update funcation", "groupID", server.GroupID, "server", server, "local", local)
log.ZInfo(ctx, "groupSyncer trigger update function", "groupID", server.GroupID, "server", server, "local", local)
return g.db.UpdateGroup(ctx, server)
}, func(value *model_struct.LocalGroup) string {
return value.GroupID
Expand Down
1 change: 1 addition & 0 deletions internal/interaction/long_conn_mgr.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ func (c *LongConnMgr) SendReqWaitResp(ctx context.Context, m proto.Message, reqI
func (c *LongConnMgr) readPump(ctx context.Context) {
log.ZDebug(ctx, "readPump start", "goroutine ID:", getGoroutineID())
defer func() {
_ = c.close()
log.ZWarn(c.ctx, "readPump closed", c.closedErr)
}()
connNum := 0
Expand Down
Loading