Start the progress reporter once per snapshot, not once per path (closes #253)
check / check (push) Successful in 19m54s
check / check (push) Successful in 19m54s
A backup without --cron of a snapshot with two or more paths panicked with "close of closed channel". Scan runs once per path, and it started the progress reporter and deferred its Stop each time; Stop closes the reporter's signal channel, so the second path's Stop panicked. scanAllDirectories now starts the reporter before the first path and stops it after the last, and Scan no longer starts or stops it. A new test backs up a two-path snapshot with the reporter on and restores both paths. Model: opus-5-5
This commit was merged in pull request #255.
This commit is contained in:
@@ -224,12 +224,6 @@ func (s *Scanner) Scan(
|
||||
log.Debug("No storage configured, blobs will not be uploaded")
|
||||
}
|
||||
|
||||
// Start progress reporting if enabled
|
||||
if s.progress != nil {
|
||||
s.progress.Start()
|
||||
defer s.progress.Stop()
|
||||
}
|
||||
|
||||
// Phase 0: Repair any state left by an interrupted previous run, then
|
||||
// load known files and chunks from the database into memory for fast
|
||||
// lookup.
|
||||
@@ -300,7 +294,9 @@ func (s *Scanner) Scan(
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// GetProgress returns the progress reporter for this scanner
|
||||
// GetProgress returns the progress reporter for this scanner, or nil when
|
||||
// progress is off. Scan neither starts nor stops it: the caller does,
|
||||
// once for all the paths it scans, because a second Stop panics.
|
||||
func (s *Scanner) GetProgress() *ProgressReporter {
|
||||
return s.progress
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user