diff --git a/server/imserver_new/constant/constant.go b/server/imserver_new/constant/constant.go index 2d3b1f1f..f993f2bb 100644 --- a/server/imserver_new/constant/constant.go +++ b/server/imserver_new/constant/constant.go @@ -36,6 +36,11 @@ const ( GAME_ID = 2006 ) +const ( + MEMBER_LOCK_KEY = "member:" + GUILD_LOCK_KEY = "guild:" +) + // im server chat const ( CCBegin = iota diff --git a/server/imserver_new/guild/guildmgr.go b/server/imserver_new/guild/guildmgr.go index 440ac5f1..c8bab7a5 100644 --- a/server/imserver_new/guild/guildmgr.go +++ b/server/imserver_new/guild/guildmgr.go @@ -153,10 +153,6 @@ func (this* guildMgr) removeUsingName(name string) { delete(this.usingNameHash, name) } -func (this* guildMgr) genMemberLockKeys(accountIds []string) []string { - return accountIds -} - func (this *guildMgr) asyncCreateGuildTask(task *f5.AsyncTask, accountId string, avatar int32, name string, cb func(int32, string, int64)) { if this.internalGetGuildByAccountId(accountId) != nil { @@ -240,8 +236,9 @@ func (this *guildMgr) asyncCreateGuildTask(task *f5.AsyncTask, accountId string, func (this *guildMgr) AsyncCreateGuild(accountId string, avatar int32, name string, cb func(int32, string, int64)) { - lockKeys := this.genMemberLockKeys([]string{accountId}) - f5.GetApp().AsyncLock(lockKeys, + f5.GetApp().AsyncLock([][]string{ + {constant.MEMBER_LOCK_KEY, accountId}, + }, f5.NewAsyncTask( func (task *f5.AsyncTask) { this.asyncCreateGuildTask(task, accountId, avatar, name, cb) @@ -324,8 +321,10 @@ func (this *guildMgr) asyncAcceptApplyTask(task *f5.AsyncTask, } func (this *guildMgr) AsyncAcceptApply(accountId string, targetId string, cb func(int32, string)) { - lockKeys := this.genMemberLockKeys([]string{accountId}) - f5.GetApp().AsyncLock(lockKeys, + f5.GetApp().AsyncLock([][]string{ + {constant.MEMBER_LOCK_KEY, accountId}, + {constant.MEMBER_LOCK_KEY, targetId}, + }, f5.NewAsyncTask( func (task *f5.AsyncTask) { this.asyncAcceptApplyTask(task, accountId, targetId, cb)