mirror of
https://github.com/restic/restic.git
synced 2026-10-12 21:17:12 +00:00
forget - missing lock for 'failedSnIDs' (#22100)
This commit is contained in:
1 parent
519a979107
commit
9da3b87b07
1 file changed
+4
@@ -6,6 +6,7 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
"strconv"
|
||||
"sync"
|
||||
|
||||
"github.com/restic/restic/internal/data"
|
||||
"github.com/restic/restic/internal/errors"
|
||||
@@ -317,10 +318,13 @@ func runForget(ctx context.Context, opts ForgetOptions, pruneOptions PruneOption
|
||||
if len(removeSnIDs) > 0 {
|
||||
if !opts.DryRun {
|
||||
bar := printer.NewCounter("files deleted")
|
||||
var lock sync.Mutex
|
||||
err := restic.ParallelRemove(ctx, repo, removeSnIDs, restic.WriteableSnapshotFile, func(id restic.ID, err error) error {
|
||||
if err != nil {
|
||||
printer.E("unable to remove %v/%v from the repository\n", restic.SnapshotFile, id)
|
||||
lock.Lock()
|
||||
failedSnIDs.Insert(id)
|
||||
lock.Unlock()
|
||||
} else {
|
||||
printer.VV("removed %v/%v\n", restic.SnapshotFile, id)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user