mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-11-17 14:13:49 +08:00
Merge 13de343f77de4aa2882ab0f0d20f787eed80bdde into 49b270918f68526dc5974cd1a0997c130618ed6d
This commit is contained in:
commit
28162148ff
@ -133,7 +133,7 @@ func (*MsgDocModel) GetMsgIndex(seq int64) int64 {
|
||||
}
|
||||
|
||||
func (*MsgDocModel) GetLimitForSingleDoc(seq int64) int64 {
|
||||
return seq % singleGocMsgNum
|
||||
return (seq - 1) % singleGocMsgNum
|
||||
}
|
||||
|
||||
func (*MsgDocModel) indexGen(conversationID string, seqSuffix int64) string {
|
||||
|
||||
12
pkg/common/storage/model/msg_test.go
Normal file
12
pkg/common/storage/model/msg_test.go
Normal file
@ -0,0 +1,12 @@
|
||||
package model
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestMsgDocModelGetLimitForSingleDoc(t *testing.T) {
|
||||
model := new(MsgDocModel)
|
||||
for _, test := range []struct{ seq, want int64 }{{1, 0}, {99, 98}, {100, 99}, {101, 0}} {
|
||||
if got := model.GetLimitForSingleDoc(test.seq); got != test.want {
|
||||
t.Errorf("GetLimitForSingleDoc(%d) = %d, want %d", test.seq, got, test.want)
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user