Add both dq and udq
This commit is contained in:
parent
9324fa113d
commit
154c5d65ab
@ -286,17 +286,25 @@ func (c *Collections) Get(
|
||||
"num_paths_entries", len(oldPaths),
|
||||
"num_deltas_entries", numOldDelta)
|
||||
|
||||
delta, paths, excluded, err := collectItems(
|
||||
ictx,
|
||||
c.handler.NewItemPager(driveID, "", api.DriveItemSelectDefault()),
|
||||
driveID,
|
||||
driveName,
|
||||
c.UpdateCollections,
|
||||
oldPaths,
|
||||
prevDelta,
|
||||
errs)
|
||||
if err != nil {
|
||||
return nil, false, err
|
||||
var delta DeltaUpdate
|
||||
var paths map[string]string
|
||||
var excluded map[string]struct{}
|
||||
|
||||
for i := 0; i < 3; i++ {
|
||||
logger.Ctx(ctx).Info("Delta query - original begin")
|
||||
delta, paths, excluded, err = collectItems(
|
||||
ictx,
|
||||
c.handler.NewItemPager(driveID, "", api.DriveItemSelectDefault()),
|
||||
driveID,
|
||||
driveName,
|
||||
c.UpdateCollections,
|
||||
oldPaths,
|
||||
prevDelta,
|
||||
errs)
|
||||
if err != nil {
|
||||
return nil, false, err
|
||||
}
|
||||
logger.Ctx(ctx).Info("Delta query - original end")
|
||||
}
|
||||
|
||||
// Used for logging below.
|
||||
@ -342,6 +350,29 @@ func (c *Collections) Get(
|
||||
}
|
||||
}
|
||||
|
||||
for i := 0; i < 3; i++ {
|
||||
logger.Ctx(ctx).Info("Delta query - URL cache begin")
|
||||
err = c.addURLCacheToDriveCollections(
|
||||
ictx,
|
||||
driveID,
|
||||
prevDelta,
|
||||
errs)
|
||||
if err != nil {
|
||||
return nil, false, err
|
||||
}
|
||||
|
||||
var uc *urlCache
|
||||
for _, driveColls := range c.CollectionMap {
|
||||
for _, coll := range driveColls {
|
||||
uc = coll.urlCache.(*urlCache)
|
||||
}
|
||||
}
|
||||
|
||||
uc.RefreshCache(ctx)
|
||||
|
||||
logger.Ctx(ctx).Info("Delta query - URL cache end")
|
||||
}
|
||||
|
||||
// For both cases we don't need to do set difference on folder map if the
|
||||
// delta token was valid because we should see all the changes.
|
||||
if !delta.Reset {
|
||||
|
||||
@ -112,7 +112,7 @@ func (uc *urlCache) getItemProperties(
|
||||
ctx = clues.Add(ctx, "drive_id", uc.driveID)
|
||||
|
||||
if uc.needsRefresh() {
|
||||
err := uc.refreshCache(ctx)
|
||||
err := uc.RefreshCache(ctx)
|
||||
if err != nil {
|
||||
return itemProps{}, err
|
||||
}
|
||||
@ -137,7 +137,7 @@ func (uc *urlCache) needsRefresh() bool {
|
||||
}
|
||||
|
||||
// refreshCache refreshes the URL cache by performing a delta query.
|
||||
func (uc *urlCache) refreshCache(
|
||||
func (uc *urlCache) RefreshCache(
|
||||
ctx context.Context,
|
||||
) error {
|
||||
// Acquire mutex to prevent multiple threads from refreshing the
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user