mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-11-21 00:23:41 +08:00
fix(core): force to replace send time when malloc seq
# Conflicts: # pkg/common/storage/controller/msg_transfer.go # Conflicts: # pkg/common/storage/controller/msg_transfer.go
This commit is contained in:
parent
7788c86721
commit
44e96853f2
@ -2,12 +2,16 @@ package controller
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
|
||||
"github.com/openimsdk/open-im-server/v3/pkg/common/convert"
|
||||
"github.com/openimsdk/protocol/constant"
|
||||
"github.com/openimsdk/tools/mq"
|
||||
"github.com/openimsdk/tools/utils/datautil"
|
||||
"google.golang.org/protobuf/proto"
|
||||
|
||||
"go.mongodb.org/mongo-driver/mongo"
|
||||
|
||||
"github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache"
|
||||
"github.com/openimsdk/open-im-server/v3/pkg/common/storage/database"
|
||||
@ -16,7 +20,6 @@ import (
|
||||
"github.com/openimsdk/protocol/sdkws"
|
||||
"github.com/openimsdk/tools/errs"
|
||||
"github.com/openimsdk/tools/log"
|
||||
"go.mongodb.org/mongo-driver/mongo"
|
||||
)
|
||||
|
||||
type MsgTransferDatabase interface {
|
||||
@ -206,6 +209,8 @@ func (db *msgTransferDatabase) BatchInsertChat2Cache(ctx context.Context, conver
|
||||
if lenList < 1 {
|
||||
return 0, false, nil, errs.New("no messages to insert", "minCount", 1).Wrap()
|
||||
}
|
||||
//force to lead time as same
|
||||
sendTime := time.Now().UnixMilli()
|
||||
currentMaxSeq, err := db.seqConversation.Malloc(ctx, conversationID, int64(len(msgs)))
|
||||
if err != nil {
|
||||
log.ZError(ctx, "storage.seq.Malloc", err)
|
||||
@ -218,6 +223,7 @@ func (db *msgTransferDatabase) BatchInsertChat2Cache(ctx context.Context, conver
|
||||
for _, m := range msgs {
|
||||
currentMaxSeq++
|
||||
m.Seq = currentMaxSeq
|
||||
m.SendTime = sendTime
|
||||
userSeqMap[m.SendID] = m.Seq
|
||||
seqs = append(seqs, m.Seq)
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user