diff --git a/server/imserver_new/cache/cachemgr.go b/server/imserver_new/cache/cachemgr.go index 7cd8a264..504d4571 100644 --- a/server/imserver_new/cache/cachemgr.go +++ b/server/imserver_new/cache/cachemgr.go @@ -8,19 +8,12 @@ import ( "main/constant" ) -type pendingUser struct { - accountId string - reqTime int64 -} - type cacheMgr struct { userHash map[string]*userProfile - pendingHash map[string]*pendingUser } func (this *cacheMgr) Init() { this.userHash = make(map[string]*userProfile) - this.pendingHash = make(map[string]*pendingUser) } func (this *cacheMgr) UnInit() { @@ -90,7 +83,20 @@ func (this *cacheMgr) AsyncSearch(sinceId int64, q string, } func (this *cacheMgr) internalGetUsers(accountIds []string, cb func(int32, string)) { - + keys := [][]string{} + for _, accountId := range(accountIds) { + if this.getUser(accountId) == nil { + q5.AppendSlice(&keys, []string{constant.CACHE_LOCK_KEY, accountId}) + } + } + if len(keys) <= 0{ + cb(0, "") + return + } + f5.NewLockAsyncTask( + keys, + func (task *f5.LockAsyncTask) { + }) } func (this *cacheMgr) getUser(accountId string) *userProfile {