fix: Re-read value after `once` initialization (#35642)

Related to #35641
See also #35271

Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
pull/35656/head
congqixia 2024-08-22 17:24:58 +08:00 committed by GitHub
parent 582d2eec79
commit 9fff07936a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 2 deletions

View File

@ -41,12 +41,14 @@ func getPriCache() *PrivilegeCache {
priCacheInitOnce.Do(func() {
priCacheMut.Lock()
defer priCacheMut.Unlock()
c = &PrivilegeCache{
priCache = &PrivilegeCache{
version: ver.Inc(),
values: typeutil.ConcurrentMap[string, bool]{},
}
priCache = c
})
priCacheMut.RLock()
defer priCacheMut.RUnlock()
c = priCache
}
return c