Fix incremental usage accounting (#12871)

Remote caches were not returned correctly, so they would not get updated on save.

Furthermore make some tweaks for more reliable updates.

Invalidate bloom filter to ensure rescan.
This commit is contained in:
Klaus Post authored and GitHub committed 2021-08-04 09:14:14 -07:00
1 parent 4197870287
commit cc60d66909
5 files changed
+21 -8

No files matched your search

+13 -3
View File
@@ -525,12 +525,22 @@ func (f *folderScanner) scanFolder(ctx context.Context, folder cachedFolder, int
return
}
if !into.Compacted {
into.addChild(dataUsageHash(folder.name))
h := dataUsageHash(folder.name)
into.addChild(h)
// We scanned a folder, optionally send update.
f.updateCache.deleteRecursive(h)
f.updateCache.copyWithChildren(&f.newCache, h, folder.parent)
f.sendUpdate()
}
// We scanned a folder, optionally send update.
f.sendUpdate()
}
// Transfer existing
if !into.Compacted {
for _, folder := range existingFolders {
h := hashPath(folder.name)
f.updateCache.copyWithChildren(&f.oldCache, h, folder.parent)
}
}
// Scan new...
for _, folder := range newFolders {
h := hashPath(folder.name)