fix: fix metaCache cleanup issue when listPolicy failed (#34449)

issue: #34667

---------

Signed-off-by: balloon1995 <hszoe1995@outlook.com>
Co-authored-by: congqixia <congqi.xia@zilliz.com>
This commit is contained in:
balloon1995 2024-07-16 10:03:38 +08:00 committed by GitHub
parent b5225df21c
commit 7306d2d115
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1119,6 +1119,13 @@ func (m *MetaCache) RefreshPolicyInfo(op typeutil.CacheOp) (err error) {
return err
}
if !merr.Ok(resp.GetStatus()) {
log.Error("fail to init meta cache",
zap.String("error_code", resp.GetStatus().GetErrorCode().String()),
zap.String("reason", resp.GetStatus().GetReason()))
return merr.Error(resp.Status)
}
m.mu.Lock()
defer m.mu.Unlock()
m.userToRoles = make(map[string]map[string]struct{})