Skip to content

Commit

Permalink
Properly handle cache error and return userdata (#1571)
Browse files Browse the repository at this point in the history
  • Loading branch information
mlsmaycon authored Feb 12, 2024
1 parent 88747e3 commit dd14db6
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions management/server/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit dd14db6

Please sign in to comment.