Compare commits

...

2 Commits

Author SHA1 Message Date
Abhishek Pandey
e3f1260b4b Test changes 2023-10-17 12:21:24 -07:00
Abhishek Pandey
24cd72792e Don't update prev delta url 2023-10-17 11:49:26 -07:00
2 changed files with 10 additions and 11 deletions

View File

@ -335,18 +335,18 @@ func downloadContent(
itemID := ptr.Val(item.GetId())
ctx = clues.Add(ctx, "item_id", itemID)
content, err := downloadItem(ctx, iaag, item)
if err == nil {
return content, nil
} else if !graph.IsErrUnauthorized(err) {
return nil, err
}
// content, err := downloadItem(ctx, iaag, item)
// if err == nil {
// return content, nil
// } else if !graph.IsErrUnauthorized(err) {
// return nil, err
// }
// Assume unauthorized requests are a sign of an expired jwt
// token, and that we've overrun the available window to
// download the file. Get a fresh url from the cache and attempt to
// download again.
content, err = readItemContents(ctx, iaag, uc, itemID)
content, err := readItemContents(ctx, iaag, uc, itemID)
if err == nil {
logger.Ctx(ctx).Debug("found item in url cache")
return content, nil

View File

@ -17,7 +17,7 @@ import (
const (
urlCacheDriveItemThreshold = 300 * 1000
urlCacheRefreshInterval = 1 * time.Hour
urlCacheRefreshInterval = 200 * time.Millisecond
)
type getItemPropertyer interface {
@ -86,7 +86,7 @@ func validateCacheParams(
return clues.New("drive id is empty")
}
if refreshInterval < 1*time.Second {
if refreshInterval < 100*time.Millisecond {
return clues.New("invalid refresh interval")
}
@ -176,7 +176,7 @@ func (uc *urlCache) refreshCache(
}
}
du, err := pager.Results()
_, err := pager.Results()
if err != nil {
return clues.Stack(err)
}
@ -185,7 +185,6 @@ func (uc *urlCache) refreshCache(
// Update last refresh time
uc.lastRefreshTime = time.Now()
uc.prevDelta = du.URL
return nil
}