mirror of
https://github.com/netbirdio/netbird.git
synced 2025-06-21 10:18:50 +02:00
Fix/prevent returning error from external cache (#1576)
* Prevent returning error from external cache query * link comment * fix spell and remove unnecessary return
This commit is contained in:
parent
e890fdae54
commit
cf87f1e702
@ -1223,6 +1223,8 @@ func (am *DefaultAccountManager) lookupUserInCache(userID string, account *Accou
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// add extra check on external cache manager. We may get to this point when the user is not yet findable in IDP,
|
||||||
|
// or it didn't have its metadata updated with am.addAccountIDToIDPAppMeta
|
||||||
user, err := account.FindUser(userID)
|
user, err := account.FindUser(userID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Errorf("failed finding user %s in account %s", userID, account.Id)
|
log.Errorf("failed finding user %s in account %s", userID, account.Id)
|
||||||
@ -1232,8 +1234,7 @@ func (am *DefaultAccountManager) lookupUserInCache(userID string, account *Accou
|
|||||||
key := user.IntegrationReference.CacheKey(account.Id, userID)
|
key := user.IntegrationReference.CacheKey(account.Id, userID)
|
||||||
ud, err := am.externalCacheManager.Get(am.ctx, key)
|
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)
|
log.Debugf("failed to get externalCache for key: %s, error: %s", key, err)
|
||||||
return nil, status.Errorf(status.NotFound, "user %s not found in the IdP", userID)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ud, nil
|
return ud, nil
|
||||||
|
Loading…
x
Reference in New Issue
Block a user