Skip to content

Commit

Permalink
fix: remove stranger func in user model. (#319)
Browse files Browse the repository at this point in the history
* fix: message status change

* fix: page pull change args

* feat: add wasm multipart upload

* feat: add wasm multipart upload

* feat: add wasm multipart upload

* test: log add

* test: log add

* refactor: remove session type

* refactor: remove session type

* refactor: remove session type

* refactor: remove session type

* refactor: syncer update

* refactor: syncer update

* refactor: syncer update

* refactor: syncer update

* refactor: syncer update

* refactor: syncer update

* refactor: go-cmp change version

* feat: wasm add upload file

* feat: wasm add upload file

* refactor: user update

* refactor: upload file add content type

* refactor: conversation trigger

* refactor: conversation trigger

* fix: msg file ContentType

* test: log  add

* chore: makefile update

* fix: sync user info error

* fix: send video message blocking

Signed-off-by: Gordon <[email protected]>

* fix: logout don't callback when network can not establish

Signed-off-by: Gordon <[email protected]>

* fix: logout don't callback when network can not establish

Signed-off-by: Gordon <[email protected]>

* new feat: sync less data

* new feat: sync less data

* fix: still reconn when token is invalid

Signed-off-by: Gordon <[email protected]>

* fix: sendMessage not oss add content

Signed-off-by: Gordon <[email protected]>

* flag

Signed-off-by: hanzhixiao <[email protected]>

* fix bug: friend wasm sql

* fix: kick logout

Signed-off-by: Gordon <[email protected]>

* fix: kick logout

Signed-off-by: Gordon <[email protected]>

* fix bug: friend msg syncer

* fix: wasm db close

Signed-off-by: Gordon <[email protected]>

* fix: wasm db close

Signed-off-by: Gordon <[email protected]>

* Fix: wasm close db (#176)

* fix: message status change

* fix: page pull change args

* feat: add wasm multipart upload

* feat: add wasm multipart upload

* feat: add wasm multipart upload

* test: log add

* test: log add

* refactor: remove session type

* refactor: remove session type

* refactor: remove session type

* refactor: remove session type

* refactor: syncer update

* refactor: syncer update

* refactor: syncer update

* refactor: syncer update

* refactor: syncer update

* refactor: syncer update

* refactor: go-cmp change version

* feat: wasm add upload file

* feat: wasm add upload file

* refactor: user update

* refactor: upload file add content type

* refactor: conversation trigger

* refactor: conversation trigger

* fix: msg file ContentType

* test: log  add

* chore: makefile update

* fix: sync user info error

* fix: send video message blocking

Signed-off-by: Gordon <[email protected]>

* fix: logout don't callback when network can not establish

Signed-off-by: Gordon <[email protected]>

* fix: logout don't callback when network can not establish

Signed-off-by: Gordon <[email protected]>

* fix: still reconn when token is invalid

Signed-off-by: Gordon <[email protected]>

* fix: sendMessage not oss add content

Signed-off-by: Gordon <[email protected]>

* fix: kick logout

Signed-off-by: Gordon <[email protected]>

* fix: kick logout

Signed-off-by: Gordon <[email protected]>

* fix: wasm db close

Signed-off-by: Gordon <[email protected]>

* fix: wasm db close

Signed-off-by: Gordon <[email protected]>

---------

Signed-off-by: Gordon <[email protected]>
Co-authored-by: withchao <[email protected]>

* fix: search messages add localEx field

Signed-off-by: Gordon <[email protected]>

* test

Signed-off-by: hanzhixiao <[email protected]>

* fix bug: user update name and faceurl not sync

* feat: conversation local ex

* feat: conversation local ex

* fix bug: sync failed

* presuretest code

* test

* test: pressure test code

* fix: program will crash when websocket just initialized and send message

Signed-off-by: Gordon <[email protected]>

* feature: add function of unInitSDK

Signed-off-by: Gordon <[email protected]>

* test: add function of create group and send messages

Signed-off-by: Gordon <[email protected]>

* test: add function of create group and send messages

Signed-off-by: Gordon <[email protected]>

* fxi: pull messages with pagination and send message add reply timeout.

Signed-off-by: Gordon <[email protected]>

* feat: wasm add business listener

Signed-off-by: Gordon <[email protected]>

* feat: log level can set gorm log level

Signed-off-by: Gordon <[email protected]>

* fix: user goroutine did not exit when ws dial because of token invalid or expired

Signed-off-by: Gordon <[email protected]>

* fix: err message update

Signed-off-by: Gordon <[email protected]>

* test: panic recover

Signed-off-by: Gordon <[email protected]>

* fix: avoid panic when local don't have message

Signed-off-by: Gordon <[email protected]>

* test: test args change

Signed-off-by: Gordon <[email protected]>

* fix: some messages seq is zero,filter this message and print exception info

Signed-off-by: Gordon <[email protected]>

* fix: user online status pb change

Signed-off-by: Gordon <[email protected]>

* test: add sdk user send message

Signed-off-by: Gordon <[email protected]>

* test: add sdk user send message

Signed-off-by: Gordon <[email protected]>

* fix: sync conversation panic when some groups deleted in server that user joined groups.

Signed-off-by: Gordon <[email protected]>

* fix: sdk trigger token expired callback

Signed-off-by: Gordon <[email protected]>

* fix: sdk remove group sync concurrent,maybe cause sync group members failed.

Signed-off-by: Gordon <[email protected]>

* fix: do not update group message when get user info.

Signed-off-by: Gordon <[email protected]>

* fix: private chat notification update.

Signed-off-by: Gordon <[email protected]>

* fix: change the conversation to synchronous retrieval.

Signed-off-by: Gordon <[email protected]>

* fix: split pull message.

Signed-off-by: Gordon <[email protected]>

* fix: user status online add to main func.

* fix: pull notifications.

* fix: pull notifications.

* fix: message update latest icon and name when first sync message.

* fix: message update latest icon and name when first sync message.

* fix: message update latest icon and name when first sync message.

* fix: stranger user model add wasm set func.

Signed-off-by: Gordon <[email protected]>

* fix: stranger user model add wasm set func.

* tes: change num of sender.

Signed-off-by: Gordon <[email protected]>

* fix: create a group, group members greater than 5000 report an error

* fix: remove stranger func in user model.

Signed-off-by: Gordon <[email protected]>

---------

Signed-off-by: Gordon <[email protected]>
Signed-off-by: hanzhixiao <[email protected]>
Signed-off-by: Gordon <[email protected]>
Co-authored-by: wangchuxiao <[email protected]>
Co-authored-by: withchao <[email protected]>
Co-authored-by: hanzhixiao <[email protected]>
Co-authored-by: withchao <[email protected]>
  • Loading branch information
5 people authored Sep 7, 2023
1 parent 122aa78 commit 74ebfe2
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 33 deletions.
36 changes: 34 additions & 2 deletions msgtest/module/group_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,15 @@ func (t *TestGroupManager) GenGroupID(prefix string) string {
}

func (t *TestGroupManager) CreateGroup(groupID string, groupName string, ownerUserID string, userIDs []string) error {
const batch = 2000
var memberUserIDs []string
if len(userIDs) > batch {
memberUserIDs = userIDs[:batch]
} else {
memberUserIDs = userIDs
}
req := &group.CreateGroupReq{
MemberUserIDs: userIDs,
MemberUserIDs: memberUserIDs,
OwnerUserID: ownerUserID,
GroupInfo: &sdkws.GroupInfo{
GroupID: groupID,
Expand All @@ -30,7 +37,32 @@ func (t *TestGroupManager) CreateGroup(groupID string, groupName string, ownerUs
},
}
resp := &group.CreateGroupResp{}
return t.postWithCtx(constant.CreateGroupRouter, &req, &resp)
if err := t.postWithCtx(constant.CreateGroupRouter, &req, &resp); err != nil {
return err
}
if len(userIDs) > batch {
num := len(userIDs) / batch
if len(userIDs)%batch != 0 {
num++
}
for i := 1; i < num; i++ {
start := batch * i
end := batch*i + batch
if len(userIDs) < end {
end = len(userIDs)
}
req := map[string]any{
"groupID": groupID,
"invitedUserIDs": userIDs[start:end],
"reason": "test",
}
resp := struct{}{}
if err := t.postWithCtx(constant.RouterGroup+"/invite_user_to_group", req, &resp); err != nil {
return err
}
}
}
return nil
}

func (t *TestGroupManager) InviteUserToGroup(ctx context.Context, groupID string, invitedUserIDs []string) error {
Expand Down
8 changes: 4 additions & 4 deletions msgtest/pressure_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func InitWithFlag() {
flag.IntVar(&msgSenderNumEvreyUser, "m", 100, "msg sender num evrey user")

flag.IntVar(&recvMsgUserNum, "r", 20, "recv msg user num")
flag.IntVar(&fastenedUserNum, "u", 320, "fastened user num")
flag.IntVar(&fastenedUserNum, "u", 300, "fastened user num")
}

func init() {
Expand Down Expand Up @@ -128,7 +128,7 @@ func NewPressureTester() *PressureTester {

func (p *PressureTester) genUserIDs() (userIDs, fastenedUserIDs, recvMsgUserIDs []string) {
userIDs = p.userManager.GenUserIDs(totalOnlineUserNum - fastenedUserNum) // 在线用户
fastenedUserIDs = p.userManager.GenUserIDsWithPrefix(fastenedUserNum, FastenedUserPrefix) // 指定320用户
fastenedUserIDs = p.userManager.GenUserIDsWithPrefix(fastenedUserNum, FastenedUserPrefix) // 指定300用户
recvMsgUserIDs = p.userManager.GenUserIDsWithPrefix(recvMsgUserNum, RecvMsgPrefix) // 抽样用户完整SDK
return
}
Expand Down Expand Up @@ -200,7 +200,7 @@ func (p *PressureTester) createTestGroups(userIDs, fastenedUserIDs, recvMsgUserI
}
p.tenThousandGroupIDs = append(p.tenThousandGroupIDs, groupID)
}
// create thousand group
// create two thousand group
exclude := TenThousandGroupNum * TenThousandGroupUserNum
for i := 1; i <= ThousandGroupNum; i++ {
groupID := p.groupManager.GenGroupID(fmt.Sprintf("thousandGroup_%d", i))
Expand All @@ -210,7 +210,7 @@ func (p *PressureTester) createTestGroups(userIDs, fastenedUserIDs, recvMsgUserI
}
p.thousandGroupIDs = append(p.thousandGroupIDs, groupID)
}
// create hundred group
// create five hundred group
exclude += exclude + ThousandGroupNum*ThousandGroupUserNum
for i := 1; i <= HundredGroupNum; i++ {
groupID := p.groupManager.GenGroupID(fmt.Sprintf("hundredGroup_%d", i))
Expand Down
1 change: 0 additions & 1 deletion wasm/indexdb/stranger_model.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ type LocalStrangers struct {
func NewLocalStrangers() *LocalStrangers {
return &LocalStrangers{}
}

func (l *LocalStrangers) GetStrangerInfo(ctx context.Context, userIDs []string) (result []*model_struct.LocalStranger, err error) {
gList, err := exec.Exec(utils.StructToJsonString(userIDs))
if err != nil {
Expand Down
26 changes: 0 additions & 26 deletions wasm/indexdb/user_model.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,29 +94,3 @@ func (l *LocalUsers) InsertLoginUser(ctx context.Context, user *model_struct.Loc
_, err := exec.Exec(utils.StructToJsonString(temp))
return err
}

func (l *LocalUsers) GetStrangerInfo(ctx context.Context, userIDs []string) (result []*model_struct.LocalStranger, err error) {
gList, err := exec.Exec(utils.StructToJsonString(userIDs))
if err != nil {
return nil, err
} else {
if v, ok := gList.(string); ok {
var temp []model_struct.LocalStranger
err := utils.JsonStringToStruct(v, &temp)
if err != nil {
return nil, err
}
for _, v := range temp {
v1 := v
result = append(result, &v1)
}
return result, err
} else {
return nil, exec.ErrType
}
}
}

func (l *LocalUsers) SetStrangerInfo(ctx context.Context, strangerList []*model_struct.LocalStranger) error {
return nil
}

0 comments on commit 74ebfe2

Please sign in to comment.