Skip to content

Commit

Permalink
chore: test_delay trace
Browse files Browse the repository at this point in the history
  • Loading branch information
dongchengjie committed Jun 5, 2024
1 parent 05b1de6 commit 1938024
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src-tauri/src/feat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -385,11 +385,19 @@ pub async fn test_delay(url: String) -> Result<u32> {
.get(url).header("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 Edg/120.0.0.0");
let start = Instant::now();

let response = request.send().await?;
if response.status().is_success() {
let delay = start.elapsed().as_millis() as u32;
Ok(delay)
} else {
Ok(10000u32)
let response = request.send().await;
match response {
Ok(response) => {
log::trace!(target: "app", "test_delay response: {:#?}", response);
if response.status().is_success() {
Ok(start.elapsed().as_millis() as u32)
} else {
Ok(10000u32)
}
}
Err(err) => {
log::trace!(target: "app", "test_delay error: {:#?}", err);
Err(err.into())
}
}
}

0 comments on commit 1938024

Please sign in to comment.