2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-22 12:55:18 +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 {