fix: [2.4] Re-read value after once initialization (#35643)

Cherry-pick from master
pr: #35642
Related to #35641
See also #35271

Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
This commit is contained in:
congqixia 2024-08-22 16:30:57 +08:00 committed by GitHub
parent e014ad9280
commit 9c67965d6c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

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