Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Properly handle cache error and return userdata #1571

Merged
merged 1 commit into from
Feb 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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