Properly handle cache error and return userdata (#1571)

This commit is contained in:
Maycon Santos 2024-02-12 21:54:16 +01:00 committed by GitHub
parent 88747e3e01
commit dd14db6478
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1231,14 +1231,12 @@ func (am *DefaultAccountManager) lookupUserInCache(userID string, account *Accou
key := user.IntegrationReference.CacheKey(account.Id, userID)
ud, err := am.externalCacheManager.Get(am.ctx, key)
if err == nil {
if err != nil {
log.Errorf("failed to get externalCache for key: %s, error: %s", key, err)
return ud, status.Errorf(status.NotFound, "user %s not found in the IdP", userID)
return nil, status.Errorf(status.NotFound, "user %s not found in the IdP", userID)
}
log.Infof("user %s not found in any cache", userID)
return nil, nil //nolint:nilnil
return ud, nil
}
func (am *DefaultAccountManager) refreshCache(accountID string) ([]*idp.UserData, error) {