mirror of
https://github.com/restic/restic.git
synced 2024-12-24 08:44:52 +00:00
Clear data files in cache
This commit is contained in:
parent
e299272378
commit
3890a947ca
1 changed files with 14 additions and 0 deletions
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue