mirror of
https://github.com/octoleo/restic.git
synced 2025-04-01 05:01:50 +00:00
cache: Fix recheck logic, remove channel from inProgress
This commit is contained in:
parent
19725954ee
commit
5971650f77
7
internal/cache/backend.go
vendored
7
internal/cache/backend.go
vendored
@ -107,9 +107,9 @@ func (b *Backend) cacheFile(ctx context.Context, h restic.Handle) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// test again, maybe the file was cached in the meantime
|
// test again, maybe the file was cached in the meantime
|
||||||
if b.Cache.Has(h) {
|
if !b.Cache.Has(h) {
|
||||||
return nil
|
|
||||||
}
|
// nope, it's still not in the cache, pull it from the repo and save it
|
||||||
|
|
||||||
err := b.Backend.Load(ctx, h, 0, 0, func(rd io.Reader) error {
|
err := b.Backend.Load(ctx, h, 0, 0, func(rd io.Reader) error {
|
||||||
return b.Cache.Save(h, rd)
|
return b.Cache.Save(h, rd)
|
||||||
@ -118,6 +118,7 @@ func (b *Backend) cacheFile(ctx context.Context, h restic.Handle) error {
|
|||||||
// try to remove from the cache, ignore errors
|
// try to remove from the cache, ignore errors
|
||||||
_ = b.Cache.Remove(h)
|
_ = b.Cache.Remove(h)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// signal other waiting goroutines that the file may now be cached
|
// signal other waiting goroutines that the file may now be cached
|
||||||
close(finish)
|
close(finish)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user