repo: Clear indexes

This commit is contained in:
Alexander Neumann 2017-09-24 11:25:45 +02:00
parent 7a5fde8f5a
commit 70248bd05a
1 changed files with 12 additions and 0 deletions

View File

@ -371,10 +371,22 @@ func (r *Repository) LoadIndex(ctx context.Context) error {
ParallelWorkFuncParseID(worker))
}()
validIndex := restic.NewIDSet()
for idx := range indexes {
id, err := idx.ID()
if err == nil {
validIndex.Insert(id)
}
r.idx.Insert(idx)
}
if r.Cache != nil {
err := r.Cache.Clear(restic.IndexFile, validIndex)
if err != nil {
fmt.Fprintf(os.Stderr, "error clearing index files in cache: %v\n", err)
}
}
if err := <-errCh; err != nil {
return err
}