mirror of https://github.com/restic/restic.git
repo: Clear indexes
This commit is contained in:
parent
7a5fde8f5a
commit
70248bd05a
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue