mirror of
https://github.com/octoleo/restic.git
synced 2024-11-22 21:05:10 +00:00
Clear data files in cache
This commit is contained in:
parent
e299272378
commit
3890a947ca
@ -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 New Issue
Block a user