enhance: ping continiously

This commit is contained in:
2026-01-16 23:45:24 +08:00
parent b5c6de9c17
commit 373ad4e747

View File

@@ -177,13 +177,21 @@ async fn main() -> Result<(), Box<dyn snafu::Error>> {
human_readable_display(preview, human_readable)?; human_readable_display(preview, human_readable)?;
} }
Commands::Ping => { Commands::Ping => {
let time = SystemTime::now(); for _ in 0..10 {
let decoded: PingResp = let time = SystemTime::now();
Sdgb1_53::request(&client, APIMethod::Ping, "", Ping {}).await?; match Sdgb1_53::request::<_, PingResp>(&client, APIMethod::Ping, "", Ping {}).await
info!( {
"sdgb 1.53 resp: {decoded}, {}ms", Ok(decoded) => {
time.elapsed().unwrap_or_default().as_millis() info!(
); "sdgb 1.53 resp: {decoded}, {}ms",
time.elapsed().unwrap_or_default().as_millis()
);
}
Err(e) => {
error!("sdgb 1.53 error: {e}");
}
}
}
} }
Commands::QRLogin { ref qrcode_content } => { Commands::QRLogin { ref qrcode_content } => {
let qrcode = QRCode { qrcode_content }; let qrcode = QRCode { qrcode_content };