cache: In case of an error, fall back backend

This commit is contained in:
Alexander Neumann 2017-09-24 23:06:54 +02:00
parent db5ec5d876
commit 240c4cf2fd
1 changed files with 5 additions and 1 deletions

View File

@ -105,7 +105,11 @@ func (b *Backend) cacheFile(ctx context.Context, h restic.Handle) error {
func (b *Backend) Load(ctx context.Context, h restic.Handle, length int, offset int64) (io.ReadCloser, error) {
if b.Cache.Has(h) {
debug.Log("Load(%v, %v, %v) from cache", h, length, offset)
return b.Cache.Load(h, length, offset)
rd, err := b.Cache.Load(h, length, offset)
if err == nil {
return rd, nil
}
debug.Log("error loading %v from cache: %v", h, err)
}
// partial file requested