diff --git a/server/imserver_new/constant/constant.go b/server/imserver_new/constant/constant.go index f993f2bb..90ddad21 100644 --- a/server/imserver_new/constant/constant.go +++ b/server/imserver_new/constant/constant.go @@ -38,7 +38,8 @@ const ( const ( MEMBER_LOCK_KEY = "member:" - GUILD_LOCK_KEY = "guild:" + GUILD_ID_LOCK_KEY = "guild_id:" + GUILD_NAME_LOCK_KEY = "guild_name:" ) // im server chat diff --git a/server/imserver_new/guild/guildmgr.go b/server/imserver_new/guild/guildmgr.go index 10f8986a..e4a445fd 100644 --- a/server/imserver_new/guild/guildmgr.go +++ b/server/imserver_new/guild/guildmgr.go @@ -153,7 +153,9 @@ func (this* guildMgr) removeUsingName(name string) { delete(this.usingNameHash, name) } -func (this *guildMgr) asyncCreateGuildTask(task *f5.AsyncTask, accountId string, avatar int32, name string, +func (this *guildMgr) asyncCreateGuildTask(task *f5.AsyncTask, + guildId string, + accountId string, avatar int32, name string, cb func(int32, string, int64)) { if this.internalGetGuildByAccountId(accountId) != nil { task.SetFail() @@ -171,7 +173,6 @@ func (this *guildMgr) asyncCreateGuildTask(task *f5.AsyncTask, accountId string, return } this.addUsingName(name) - guildId := q5.ToString(f5.GetApp().NewNodeUuid()) nowTime := f5.GetApp().GetNowSeconds() f5.GetJsStyleDb().Insert( constant.FRIEND_DB, @@ -236,12 +237,15 @@ func (this *guildMgr) asyncCreateGuildTask(task *f5.AsyncTask, accountId string, func (this *guildMgr) AsyncCreateGuild(accountId string, avatar int32, name string, cb func(int32, string, int64)) { + guildId := q5.ToString(f5.GetApp().NewNodeUuid()) f5.GetApp().AsyncLock([][]string{ - {constant.MEMBER_LOCK_KEY, accountId}, + {constant.MEMBER_LOCK_KEY, accountId}, + {constant.GUILD_ID_LOCK_KEY, guildId}, + {constant.GUILD_NAME_LOCK_KEY, name}, }, f5.NewAsyncTask( func (task *f5.AsyncTask) { - this.asyncCreateGuildTask(task, accountId, avatar, name, cb) + this.asyncCreateGuildTask(task, guildId, accountId, avatar, name, cb) })) } @@ -363,7 +367,7 @@ func (this *guildMgr) AsyncAcceptApply(accountId string, targetId string, cb fun f5.GetApp().AsyncLock([][]string{ {constant.MEMBER_LOCK_KEY, accountId}, {constant.MEMBER_LOCK_KEY, targetId}, - {constant.GUILD_LOCK_KEY, guild.guildId}, + {constant.GUILD_ID_LOCK_KEY, guild.guildId}, }, f5.NewAsyncTask( func (task *f5.AsyncTask) {