mirror of
https://github.com/restic/restic.git
synced 2025-03-03 18:26:51 +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
536ebefff4
commit
58f58a995d
1 changed files with 4 additions and 1 deletions
|
@ -77,13 +77,16 @@ func ParallelRemove[FT FileTypes](ctx context.Context, repo RemoverUnpacked[FT],
|
|||
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