Commit 0af84839 authored by Lars Wirzenius's avatar Lars Wirzenius
Browse files

Merge branch 'bugfix/overlapping-progress-bars' into 'main'

fix: do not overlap "download" and "incremental" progress bars

See merge request !172
parents aa7812a9 34bbdc7f
Pipeline #347761857 passed with stage
in 6 minutes and 22 seconds
......@@ -17,7 +17,7 @@ pub struct BackupRun<'a> {
client: &'a BackupClient,
policy: BackupPolicy,
buffer_size: usize,
progress: BackupProgress,
progress: Option<BackupProgress>,
}
#[derive(Debug, thiserror::Error)]
......@@ -56,7 +56,7 @@ impl<'a> BackupRun<'a> {
client,
policy: BackupPolicy::default(),
buffer_size: config.chunk_size,
progress: BackupProgress::initial(),
progress: Some(BackupProgress::initial()),
})
}
......@@ -68,7 +68,7 @@ impl<'a> BackupRun<'a> {
client,
policy: BackupPolicy::default(),
buffer_size: config.chunk_size,
progress: BackupProgress::incremental(),
progress: None,
})
}
......@@ -87,8 +87,11 @@ impl<'a> BackupRun<'a> {
}
Some(genid) => {
let old = self.fetch_previous_generation(genid, oldname)?;
self.progress
.files_in_previous_generation(old.file_count()? as u64);
let progress = BackupProgress::incremental();
progress.files_in_previous_generation(old.file_count()? as u64);
self.progress = Some(progress);
Ok(old)
}
}
......@@ -106,7 +109,9 @@ impl<'a> BackupRun<'a> {
}
pub fn finish(&self) {
self.progress.finish();
if let Some(progress) = &self.progress {
progress.finish();
}
}
pub fn backup_roots(
......@@ -194,11 +199,15 @@ impl<'a> BackupRun<'a> {
}
fn found_live_file(&self, path: &Path) {
self.progress.found_live_file(path);
if let Some(progress) = &self.progress {
progress.found_live_file(path);
}
}
fn found_problem(&self) {
self.progress.found_problem();
if let Some(progress) = &self.progress {
progress.found_problem();
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment