Test changes
This commit is contained in:
parent
24cd72792e
commit
e3f1260b4b
@ -335,18 +335,18 @@ func downloadContent(
|
|||||||
itemID := ptr.Val(item.GetId())
|
itemID := ptr.Val(item.GetId())
|
||||||
ctx = clues.Add(ctx, "item_id", itemID)
|
ctx = clues.Add(ctx, "item_id", itemID)
|
||||||
|
|
||||||
content, err := downloadItem(ctx, iaag, item)
|
// content, err := downloadItem(ctx, iaag, item)
|
||||||
if err == nil {
|
// if err == nil {
|
||||||
return content, nil
|
// return content, nil
|
||||||
} else if !graph.IsErrUnauthorized(err) {
|
// } else if !graph.IsErrUnauthorized(err) {
|
||||||
return nil, err
|
// return nil, err
|
||||||
}
|
// }
|
||||||
|
|
||||||
// Assume unauthorized requests are a sign of an expired jwt
|
// Assume unauthorized requests are a sign of an expired jwt
|
||||||
// token, and that we've overrun the available window to
|
// token, and that we've overrun the available window to
|
||||||
// download the file. Get a fresh url from the cache and attempt to
|
// download the file. Get a fresh url from the cache and attempt to
|
||||||
// download again.
|
// download again.
|
||||||
content, err = readItemContents(ctx, iaag, uc, itemID)
|
content, err := readItemContents(ctx, iaag, uc, itemID)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
logger.Ctx(ctx).Debug("found item in url cache")
|
logger.Ctx(ctx).Debug("found item in url cache")
|
||||||
return content, nil
|
return content, nil
|
||||||
|
|||||||
@ -17,7 +17,7 @@ import (
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
urlCacheDriveItemThreshold = 300 * 1000
|
urlCacheDriveItemThreshold = 300 * 1000
|
||||||
urlCacheRefreshInterval = 1 * time.Hour
|
urlCacheRefreshInterval = 200 * time.Millisecond
|
||||||
)
|
)
|
||||||
|
|
||||||
type getItemPropertyer interface {
|
type getItemPropertyer interface {
|
||||||
@ -86,7 +86,7 @@ func validateCacheParams(
|
|||||||
return clues.New("drive id is empty")
|
return clues.New("drive id is empty")
|
||||||
}
|
}
|
||||||
|
|
||||||
if refreshInterval < 1*time.Second {
|
if refreshInterval < 100*time.Millisecond {
|
||||||
return clues.New("invalid refresh interval")
|
return clues.New("invalid refresh interval")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user