Skip to content

Commit 6a499f2

Browse files
committed
Gross hack, just loop over the job response until it works.
1 parent 1ed926c commit 6a499f2

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

src/api/job_api.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ use super::JobErrors;
77
pub async fn get_job_results(job_id: &str, auth_token: &str) -> Result<GetJobAPIResponse, JobErrors> {
88
let job_response: GetJobAPIResponse;
99
loop {
10-
11-
log::error!("ko {}", job_id);
10+
1211
let response = Client::new()
1312
.get(&format!("https://api.bitping.com/job/{}", job_id))
1413
.bearer_auth(auth_token)
@@ -19,10 +18,14 @@ pub async fn get_job_results(job_id: &str, auth_token: &str) -> Result<GetJobAPI
1918
let err_msg = match response.text().await {
2019
Ok(v) => v,
2120
Err(_) => {
22-
return Err(e.into())
21+
continue;
22+
// return Err(e.into())
2323
}
2424
};
25-
return Err(JobErrors::CustomHttpError(e, err_msg))
25+
26+
log::debug!("{} {}", e, err_msg);
27+
continue;
28+
// return Err(JobErrors::CustomHttpError(e, err_msg))
2629
}
2730

2831
let parsed_job_response: GetJobAPIResponse = response.json().await?;

src/main.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,6 @@ async fn main() -> Result<(), BpingErrors> {
104104
}
105105
};
106106

107-
tokio::time::sleep(Duration::from_millis(1000)).await;
108-
109107
let job_id = resp.id;
110108
let api_res = match api::get_job_results(&job_id, &inner_token).await {
111109
Ok(v) => v,

0 commit comments

Comments
 (0)