2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-26 06:46:34 +00:00

Check errors returned by LoadIndex()

Bug was reported in the forum here: https://forum.restic.net/t/check-rebuild-index-prune/1848/13
This commit is contained in:
Alexander Neumann 2019-06-30 21:34:53 +02:00
parent 3ca424050f
commit 88716794e3

View File

@ -440,6 +440,10 @@ func (r *Repository) LoadIndex(ctx context.Context) error {
idx, buf, err = LoadIndexWithDecoder(ctx, r, buf[:0], fi.ID, DecodeOldIndex)
}
if err != nil {
return errors.Wrap(err, fmt.Sprintf("unable to load index %v", fi.ID.Str()))
}
select {
case indexCh <- idx:
case <-ctx.Done():
@ -475,7 +479,7 @@ func (r *Repository) LoadIndex(ctx context.Context) error {
err := wg.Wait()
if err != nil {
return err
return errors.Fatal(err.Error())
}
// remove index files from the cache which have been removed in the repo