mirror of https://github.com/restic/restic.git
parallel: increment progress bar before report function which may absorb the error
* sometimes, the report function may absorb the error and return nil, in those cases the bar.Add(1) method would execute even if the file deletion had failed
This commit is contained in:
parent
536ebefff4
commit
58f58a995d
|
@ -77,13 +77,16 @@ func ParallelRemove[FT FileTypes](ctx context.Context, repo RemoverUnpacked[FT],
|
||||||
wg.Go(func() error {
|
wg.Go(func() error {
|
||||||
for id := range fileChan {
|
for id := range fileChan {
|
||||||
err := repo.RemoveUnpacked(ctx, fileType, id)
|
err := repo.RemoveUnpacked(ctx, fileType, id)
|
||||||
|
if err == nil {
|
||||||
|
// increment counter only if no error
|
||||||
|
bar.Add(1)
|
||||||
|
}
|
||||||
if report != nil {
|
if report != nil {
|
||||||
err = report(id, err)
|
err = report(id, err)
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
bar.Add(1)
|
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue