forked from TrueCloudLab/restic
repo: Clear indexes
This commit is contained in:
parent
7a5fde8f5a
commit
70248bd05a
1 changed files with 12 additions and 0 deletions
|
@ -371,10 +371,22 @@ func (r *Repository) LoadIndex(ctx context.Context) error {
|
||||||
ParallelWorkFuncParseID(worker))
|
ParallelWorkFuncParseID(worker))
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
validIndex := restic.NewIDSet()
|
||||||
for idx := range indexes {
|
for idx := range indexes {
|
||||||
|
id, err := idx.ID()
|
||||||
|
if err == nil {
|
||||||
|
validIndex.Insert(id)
|
||||||
|
}
|
||||||
r.idx.Insert(idx)
|
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 {
|
if err := <-errCh; err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue