mirror of
https://github.com/restic/restic.git
synced 2025-08-12 19:07:40 +00:00
backup: Fix deadlock
When the archiver is faster than the scanner, restic deadlocks. This commit adds a `finished` channel to the struct in `ui/backup.go` so that scanner results are ignored when the archiver is already finished. Closes #1834
This commit is contained in:
@@ -58,6 +58,9 @@ func (s *Scanner) Scan(ctx context.Context, targets []string) error {
|
||||
}
|
||||
}
|
||||
|
||||
if ctx.Err() != nil {
|
||||
return ctx.Err()
|
||||
}
|
||||
s.Result("", stats)
|
||||
return nil
|
||||
}
|
||||
@@ -107,6 +110,9 @@ func (s *Scanner) scan(ctx context.Context, stats ScanStats, target string) (Sca
|
||||
stats.Others++
|
||||
}
|
||||
|
||||
if ctx.Err() != nil {
|
||||
return stats, ctx.Err()
|
||||
}
|
||||
s.Result(target, stats)
|
||||
return stats, nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user