Add prev delta
This commit is contained in:
parent
671fd5150d
commit
1d1603e0ad
@ -394,6 +394,7 @@ func (c *Collections) Get(
|
||||
err = c.addURLCacheToDriveCollections(
|
||||
ictx,
|
||||
driveID,
|
||||
prevDelta,
|
||||
errs)
|
||||
if err != nil {
|
||||
return nil, false, err
|
||||
@ -465,11 +466,12 @@ func (c *Collections) Get(
|
||||
// a drive.
|
||||
func (c *Collections) addURLCacheToDriveCollections(
|
||||
ctx context.Context,
|
||||
driveID string,
|
||||
driveID, prevDelta string,
|
||||
errs *fault.Bus,
|
||||
) error {
|
||||
uc, err := newURLCache(
|
||||
driveID,
|
||||
prevDelta,
|
||||
urlCacheRefreshInterval,
|
||||
c.handler.NewItemPager(driveID, "", api.DriveItemSelectDefault()),
|
||||
errs)
|
||||
|
||||
@ -2739,6 +2739,7 @@ func (suite *OneDriveCollectionsUnitSuite) TestURLCacheIntegration() {
|
||||
err := c.addURLCacheToDriveCollections(
|
||||
ctx,
|
||||
driveID,
|
||||
"",
|
||||
fault.New(true))
|
||||
require.NoError(t, err, clues.ToCore(err))
|
||||
|
||||
|
||||
@ -32,6 +32,7 @@ var _ getItemPropertyer = &urlCache{}
|
||||
// urlCache caches download URLs for drive items
|
||||
type urlCache struct {
|
||||
driveID string
|
||||
prevDelta string
|
||||
idToProps map[string]itemProps
|
||||
lastRefreshTime time.Time
|
||||
refreshInterval time.Duration
|
||||
@ -48,7 +49,7 @@ type urlCache struct {
|
||||
|
||||
// newURLache creates a new URL cache for the specified drive ID
|
||||
func newURLCache(
|
||||
driveID string,
|
||||
driveID, prevDelta string,
|
||||
refreshInterval time.Duration,
|
||||
itemPager api.DriveItemEnumerator,
|
||||
errs *fault.Bus,
|
||||
@ -65,6 +66,7 @@ func newURLCache(
|
||||
idToProps: make(map[string]itemProps),
|
||||
lastRefreshTime: time.Time{},
|
||||
driveID: driveID,
|
||||
prevDelta: prevDelta,
|
||||
refreshInterval: refreshInterval,
|
||||
itemPager: itemPager,
|
||||
errs: errs,
|
||||
@ -182,7 +184,7 @@ func (uc *urlCache) deltaQuery(
|
||||
"",
|
||||
uc.updateCache,
|
||||
map[string]string{},
|
||||
"",
|
||||
uc.prevDelta,
|
||||
uc.errs)
|
||||
if err != nil {
|
||||
return clues.Wrap(err, "delta query")
|
||||
|
||||
@ -112,6 +112,7 @@ func (suite *URLCacheIntegrationSuite) TestURLCacheBasic() {
|
||||
// Create a new URL cache with a long TTL
|
||||
cache, err := newURLCache(
|
||||
suite.driveID,
|
||||
"",
|
||||
1*time.Hour,
|
||||
driveItemPager,
|
||||
fault.New(true))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user