mirror of
https://github.com/restic/restic.git
synced 2024-12-21 23:33:03 +00:00
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
6808004ad1
commit
45985e14f1
1 changed files with 4 additions and 1 deletions
|
@ -77,13 +77,16 @@ func ParallelRemove(ctx context.Context, repo RemoverUnpacked, fileList IDSet, f
|
|||
wg.Go(func() error {
|
||||
for id := range fileChan {
|
||||
err := repo.RemoveUnpacked(ctx, fileType, id)
|
||||
if err == nil {
|
||||
// increment counter only if no error
|
||||
bar.Add(1)
|
||||
}
|
||||
if report != nil {
|
||||
err = report(id, err)
|
||||
}
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
bar.Add(1)
|
||||
}
|
||||
return nil
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue