enhance: ping continiously

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

View File

@@ -177,14 +177,22 @@ async fn main() -> Result<(), Box<dyn snafu::Error>> {
human_readable_display(preview, human_readable)?;
}
Commands::Ping => {
for _ in 0..10 {
let time = SystemTime::now();
let decoded: PingResp =
Sdgb1_53::request(&client, APIMethod::Ping, "", Ping {}).await?;
match Sdgb1_53::request::<_, PingResp>(&client, APIMethod::Ping, "", Ping {}).await
{
Ok(decoded) => {
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 } => {
let qrcode = QRCode { qrcode_content };
let resp = qrcode.login(&client).await;