From e4303e3f02c20c1b66f1c027be0583b4c66af8ae Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Thu, 4 Apr 2024 14:05:11 +0800 Subject: [PATCH] 1 --- server/imserver_new/guild/guildmgr.go | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/server/imserver_new/guild/guildmgr.go b/server/imserver_new/guild/guildmgr.go index a0a0a805..440ac5f1 100644 --- a/server/imserver_new/guild/guildmgr.go +++ b/server/imserver_new/guild/guildmgr.go @@ -101,7 +101,7 @@ func (this *guildMgr) GetGuildByGuildName(guildName string) common.Guild { func (this *guildMgr) internalGetGuildByAccountId(accountId string) *guild { m := this.internalGetMemberByAccountId(accountId) if m != nil { - + return m.guild } return nil } @@ -153,8 +153,8 @@ func (this* guildMgr) removeUsingName(name string) { delete(this.usingNameHash, name) } -func (this* guildMgr) genMemberLockKey(accountId string) string { - return accountId +func (this* guildMgr) genMemberLockKeys(accountIds []string) []string { + return accountIds } func (this *guildMgr) asyncCreateGuildTask(task *f5.AsyncTask, accountId string, avatar int32, name string, @@ -240,8 +240,8 @@ func (this *guildMgr) asyncCreateGuildTask(task *f5.AsyncTask, accountId string, func (this *guildMgr) AsyncCreateGuild(accountId string, avatar int32, name string, cb func(int32, string, int64)) { - lockKey := this.genMemberLockKey(accountId) - f5.GetApp().AsyncLock(lockKey, + lockKeys := this.genMemberLockKeys([]string{accountId}) + f5.GetApp().AsyncLock(lockKeys, f5.NewAsyncTask( func (task *f5.AsyncTask) { this.asyncCreateGuildTask(task, accountId, avatar, name, cb) @@ -319,8 +319,17 @@ func (this *guildMgr) AsyncApplyJoin(accountId string, guildId string, cb func(i }) } -func (this *guildMgr) AsyncAcceptApply(string, string, func(int32, string)) { +func (this *guildMgr) asyncAcceptApplyTask(task *f5.AsyncTask, + accountId string, targetId string, cb func(int32, string)) { +} +func (this *guildMgr) AsyncAcceptApply(accountId string, targetId string, cb func(int32, string)) { + lockKeys := this.genMemberLockKeys([]string{accountId}) + f5.GetApp().AsyncLock(lockKeys, + f5.NewAsyncTask( + func (task *f5.AsyncTask) { + this.asyncAcceptApplyTask(task, accountId, targetId, cb) + })) } func (this *guildMgr) AsyncRejectApply(accountId string, guildId string,