38 lines
1.7 KiB
Diff
38 lines
1.7 KiB
Diff
# UNDF: UNDF-2026-000001023
|
|
--- a/cmd/bisync/listing.go
|
|
+++ b/cmd/bisync/listing.go
|
|
@@ -669,6 +669,7 @@ func (b *bisyncRun) modifyListing(ctx context.Context, src, dst fs.Fs, results [
|
|
if b.InGracefulShutdown {
|
|
var toKeep []string
|
|
var toRollback []string
|
|
+ toKeepSet := make(map[string]struct{})
|
|
fs.Debugf(direction, "stats for %s", direction)
|
|
trs := accounting.Stats(ctx).Transferred()
|
|
for _, tr := range trs {
|
|
@@ -678,6 +679,7 @@ func (b *bisyncRun) modifyListing(ctx context.Context, src, dst fs.Fs, results [
|
|
if tr.Error == nil && tr.Bytes > 0 || tr.Size <= 0 {
|
|
prettyprint(tr, "keeping: "+tr.Name, fs.LogLevelDebug)
|
|
toKeep = append(toKeep, tr.Name)
|
|
+ toKeepSet[tr.Name] = struct{}{}
|
|
}
|
|
}
|
|
// Dirs (for the unlikely event that the shutdown was triggered post-sync during syncEmptyDirs)
|
|
@@ -686,6 +688,7 @@ func (b *bisyncRun) modifyListing(ctx context.Context, src, dst fs.Fs, results [
|
|
if srcWinners.has(r.Name) || dstWinners.has(r.Name) {
|
|
toKeep = append(toKeep, r.Name)
|
|
fs.Infof(r.Name, "keeping empty dir")
|
|
+ toKeepSet[r.Name] = struct{}{}
|
|
}
|
|
}
|
|
}
|
|
@@ -695,7 +698,9 @@ func (b *bisyncRun) modifyListing(ctx context.Context, src, dst fs.Fs, results [
|
|
prettyprint(dstList.list, "dstList", fs.LogLevelDebug)
|
|
combinedList := Concat(oldSrc.list, oldDst.list, srcList.list, dstList.list)
|
|
for _, f := range combinedList {
|
|
- if !slices.Contains(toKeep, f) && !slices.Contains(toKeep, b.aliases.Alias(f)) && !b.opt.DryRun {
|
|
+ _, inKeep := toKeepSet[f]
|
|
+ _, aliasInKeep := toKeepSet[b.aliases.Alias(f)]
|
|
+ if !inKeep && !aliasInKeep && !b.opt.DryRun {
|
|
toRollback = append(toRollback, f)
|
|
}
|
|
}
|