5
0
mirror of git://git.proxmox.com/git/proxmox-backup.git synced 2025-01-08 21:18:07 +03:00

sync job: avoid printing NaN if no data was pulled

Previously, if there was no data to pull one could get:
> Summary: sync job pulled 0 B in 0 chunks (average rate: NaN B/s)

Now one gets the following log entry in that case:
> Summary: sync job found no new data to pull

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2024-03-07 14:31:27 +01:00
parent 126322508d
commit ed9721f2ea

View File

@ -146,15 +146,20 @@ pub fn do_sync_job(
);
let pull_stats = pull_store(&worker, pull_params).await?;
task_log!(
worker,
"Summary: sync job pulled {} in {} chunks (average rate: {}/s)",
HumanByte::from(pull_stats.bytes),
pull_stats.chunk_count,
HumanByte::new_binary(
pull_stats.bytes as f64 / pull_stats.elapsed.as_secs_f64()
),
);
if pull_stats.bytes != 0 {
let amount = HumanByte::from(pull_stats.bytes);
let rate = HumanByte::new_binary(
pull_stats.bytes as f64 / pull_stats.elapsed.as_secs_f64(),
);
task_log!(
worker,
"Summary: sync job pulled {amount} in {} chunks (average rate: {rate}/s)",
pull_stats.chunk_count,
);
} else {
task_log!(worker, "Summary: sync job found no new data to pull");
}
task_log!(worker, "sync job '{}' end", &job_id);