From 6a499f2ed2c9a3f657409ad815e549fe309aa537 Mon Sep 17 00:00:00 2001 From: Firaenix Date: Sat, 11 Sep 2021 00:07:37 +1000 Subject: [PATCH] Gross hack, just loop over the job response until it works. --- src/api/job_api.rs | 11 +++++++---- src/main.rs | 2 -- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/api/job_api.rs b/src/api/job_api.rs index 0c56af5..6c45bd8 100644 --- a/src/api/job_api.rs +++ b/src/api/job_api.rs @@ -7,8 +7,7 @@ use super::JobErrors; pub async fn get_job_results(job_id: &str, auth_token: &str) -> Result { let job_response: GetJobAPIResponse; loop { - - log::error!("ko {}", job_id); + let response = Client::new() .get(&format!("https://api.bitping.com/job/{}", job_id)) .bearer_auth(auth_token) @@ -19,10 +18,14 @@ pub async fn get_job_results(job_id: &str, auth_token: &str) -> Result v, Err(_) => { - return Err(e.into()) + continue; + // return Err(e.into()) } }; - return Err(JobErrors::CustomHttpError(e, err_msg)) + + log::debug!("{} {}", e, err_msg); + continue; + // return Err(JobErrors::CustomHttpError(e, err_msg)) } let parsed_job_response: GetJobAPIResponse = response.json().await?; diff --git a/src/main.rs b/src/main.rs index 8ba5bde..6d4bd3f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -104,8 +104,6 @@ async fn main() -> Result<(), BpingErrors> { } }; - tokio::time::sleep(Duration::from_millis(1000)).await; - let job_id = resp.id; let api_res = match api::get_job_results(&job_id, &inner_token).await { Ok(v) => v,