1
0
Fork 0
mirror of https://github.com/restic/restic.git synced 2024-12-24 00:37:28 +00:00

Clear data files in cache

This commit is contained in:
Alexander Neumann 2017-07-18 23:16:50 +02:00
parent e299272378
commit 3890a947ca

View file

@ -404,10 +404,24 @@ func (r *Repository) LoadIndex(ctx context.Context) error {
}
if r.Cache != nil {
// clear old index files
err := r.Cache.Clear(restic.IndexFile, validIndex)
if err != nil {
fmt.Fprintf(os.Stderr, "error clearing index files in cache: %v\n", err)
}
packs := restic.NewIDSet()
for _, idx := range r.idx.All() {
for id := range idx.Packs() {
packs.Insert(id)
}
}
// clear old data files
err = r.Cache.Clear(restic.DataFile, packs)
if err != nil {
fmt.Fprintf(os.Stderr, "error clearing data files in cache: %v\n", err)
}
}
if err := <-errCh; err != nil {