[pbs-devel] [PATCH proxmox-backup 3/3] server: sync: use HumanByte for task log output

Christian Ebner c.ebner at proxmox.com
Wed Mar 6 15:11:53 CET 2024


Use the methods provided by HumanByte for the output for consistency.

Signed-off-by: Christian Ebner <c.ebner at proxmox.com>
---
 src/server/pull.rs | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/server/pull.rs b/src/server/pull.rs
index 7d745c77..fc369056 100644
--- a/src/server/pull.rs
+++ b/src/server/pull.rs
@@ -9,6 +9,7 @@ use std::time::{Duration, SystemTime};
 
 use anyhow::{bail, format_err, Error};
 use http::StatusCode;
+use proxmox_human_byte::HumanByte;
 use proxmox_rest_server::WorkerTask;
 use proxmox_router::HttpError;
 use proxmox_sys::{task_log, task_warn};
@@ -657,9 +658,9 @@ async fn pull_index_chunks<I: IndexFile>(
 
     task_log!(
         worker,
-        "downloaded {} bytes ({:.2} MiB/s)",
-        bytes,
-        (bytes as f64) / (1024.0 * 1024.0 * elapsed.as_secs_f64())
+        "downloaded {} ({}/s)",
+        HumanByte::from(bytes),
+        HumanByte::new_binary(bytes as f64 / elapsed.as_secs_f64()),
     );
 
     Ok(PullStats {
-- 
2.39.2





More information about the pbs-devel mailing list