Compare commits
2 Commits
main
...
uc_delta_f
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e3f1260b4b | ||
|
|
24cd72792e |
@ -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
|
||||
|
||||
@ -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
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user