X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/6246cacc17e8b90519143e717b7241e527678be9..b7a20a386bb6bf582c4bc92d8718b883417d4c48:/services/keep-web/cache.go diff --git a/services/keep-web/cache.go b/services/keep-web/cache.go index 79701658b4..ab7c65310b 100644 --- a/services/keep-web/cache.go +++ b/services/keep-web/cache.go @@ -89,7 +89,8 @@ func (c *cache) Get(arv *arvadosclient.ArvadosClient, targetID string, forceRelo permOK := false permKey := arv.ApiToken + "\000" + targetID - if ent, cached := c.permissions.Get(permKey); cached { + if forceReload { + } else if ent, cached := c.permissions.Get(permKey); cached { ent := ent.(*cachedPermission) if ent.expire.Before(time.Now()) { c.permissions.Remove(permKey) @@ -102,6 +103,7 @@ func (c *cache) Get(arv *arvadosclient.ArvadosClient, targetID string, forceRelo var pdh string if arvadosclient.PDHMatch(targetID) { pdh = targetID + } else if forceReload { } else if ent, cached := c.pdhs.Get(targetID); cached { ent := ent.(*cachedPDH) if ent.expire.Before(time.Now()) { @@ -112,13 +114,14 @@ func (c *cache) Get(arv *arvadosclient.ArvadosClient, targetID string, forceRelo } } - collection := c.lookupCollection(pdh) - - if collection != nil && permOK && !forceReload { - return collection, nil + var collection map[string]interface{} + if pdh != "" { + collection = c.lookupCollection(pdh) } - if collection != nil { + if collection != nil && permOK { + return collection, nil + } else if collection != nil { // Ask API for current PDH for this targetID. Most // likely, the cached PDH is still correct; if so, // _and_ the current token has permission, we can