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