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_paths_entries", len(oldPaths),
|
||||||
"num_deltas_entries", numOldDelta)
|
"num_deltas_entries", numOldDelta)
|
||||||
|
|
||||||
delta, paths, excluded, err := collectItems(
|
var delta DeltaUpdate
|
||||||
ictx,
|
var paths map[string]string
|
||||||
c.handler.NewItemPager(driveID, "", api.DriveItemSelectDefault()),
|
var excluded map[string]struct{}
|
||||||
driveID,
|
|
||||||
driveName,
|
for i := 0; i < 3; i++ {
|
||||||
c.UpdateCollections,
|
logger.Ctx(ctx).Info("Delta query - original begin")
|
||||||
oldPaths,
|
delta, paths, excluded, err = collectItems(
|
||||||
prevDelta,
|
ictx,
|
||||||
errs)
|
c.handler.NewItemPager(driveID, "", api.DriveItemSelectDefault()),
|
||||||
if err != nil {
|
driveID,
|
||||||
return nil, false, err
|
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.
|
// 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
|
// 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.
|
// delta token was valid because we should see all the changes.
|
||||||
if !delta.Reset {
|
if !delta.Reset {
|
||||||
|
|||||||
@ -112,7 +112,7 @@ func (uc *urlCache) getItemProperties(
|
|||||||
ctx = clues.Add(ctx, "drive_id", uc.driveID)
|
ctx = clues.Add(ctx, "drive_id", uc.driveID)
|
||||||
|
|
||||||
if uc.needsRefresh() {
|
if uc.needsRefresh() {
|
||||||
err := uc.refreshCache(ctx)
|
err := uc.RefreshCache(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return itemProps{}, err
|
return itemProps{}, err
|
||||||
}
|
}
|
||||||
@ -137,7 +137,7 @@ func (uc *urlCache) needsRefresh() bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// refreshCache refreshes the URL cache by performing a delta query.
|
// refreshCache refreshes the URL cache by performing a delta query.
|
||||||
func (uc *urlCache) refreshCache(
|
func (uc *urlCache) RefreshCache(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
) error {
|
) error {
|
||||||
// Acquire mutex to prevent multiple threads from refreshing the
|
// Acquire mutex to prevent multiple threads from refreshing the
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user