mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-11-03 18:52:15 +08:00
fix: add logs
This commit is contained in:
parent
8658223c61
commit
bdc692f2a4
@ -32,16 +32,19 @@ func NewOnlineCache(user rpcclient.UserRpcClient, group *GroupLocalCache, rdb re
|
|||||||
Cond: sync.NewCond(l),
|
Cond: sync.NewCond(l),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ctx := mcontext.SetOperationID(context.TODO(), strconv.FormatInt(time.Now().UnixNano()+int64(rand.Uint32()), 10))
|
||||||
|
|
||||||
switch x.fullUserCache {
|
switch x.fullUserCache {
|
||||||
case true:
|
case true:
|
||||||
|
log.ZDebug(ctx, "fullUserCache is true")
|
||||||
x.mapCache = cacheutil.NewCache[string, []int32]()
|
x.mapCache = cacheutil.NewCache[string, []int32]()
|
||||||
go func() {
|
go func() {
|
||||||
ctx := mcontext.SetOperationID(context.TODO(), strconv.FormatInt(time.Now().UnixNano()+int64(rand.Uint32()), 10))
|
|
||||||
if err := x.initUsersOnlineStatus(ctx); err != nil {
|
if err := x.initUsersOnlineStatus(ctx); err != nil {
|
||||||
log.ZError(ctx, "initUsersOnlineStatus failed", err)
|
log.ZError(ctx, "initUsersOnlineStatus failed", err)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
case false:
|
case false:
|
||||||
|
log.ZDebug(ctx, "fullUserCache is false")
|
||||||
x.lruCache = lru.NewSlotLRU(1024, localcache.LRUStringHash, func() lru.LRU[string, []int32] {
|
x.lruCache = lru.NewSlotLRU(1024, localcache.LRUStringHash, func() lru.LRU[string, []int32] {
|
||||||
return lru.NewLayLRU[string, []int32](2048, cachekey.OnlineExpire/2, time.Second*3, localcache.EmptyTarget{}, func(key string, value []int32) {})
|
return lru.NewLayLRU[string, []int32](2048, cachekey.OnlineExpire/2, time.Second*3, localcache.EmptyTarget{}, func(key string, value []int32) {})
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user