dont panic on migrations that take <1s

This commit is contained in:
boring_nick 2023-06-23 08:47:26 +03:00
parent 35ac15dd84
commit 0d5283ab46
1 changed files with 5 additions and 3 deletions

View File

@ -166,9 +166,11 @@ impl Migrator {
let elapsed = started_at.elapsed();
info!("Migration finished in {elapsed:?}");
let throughput =
(total_read_bytes.load(Ordering::SeqCst) / 1024 / 1024) / (elapsed.as_secs());
info!("Average migration speed: {throughput} MiB/s");
if let Some(throughput) =
(total_read_bytes.load(Ordering::SeqCst) / 1024 / 1024).checked_div(elapsed.as_secs())
{
info!("Average migration speed: {throughput} MiB/s");
}
Ok(())
}