Improve retries logic.

This commit is contained in:
Eduard Tolosa 2023-10-23 17:49:01 -05:00
parent bc9e4043d9
commit b0876d0f16

View file

@ -47,8 +47,7 @@ pub async fn return_http_data(options: &LibOptions) -> HashMap<String, HttpData>
async move { async move {
if options.retries > 1 { if options.retries > 1 {
let mut counter = 0; for _ in 0..options.retries {
while counter < options.retries {
if let Some(resp) = https_send_fut.try_clone() { if let Some(resp) = https_send_fut.try_clone() {
if let Ok(resp) = resp.send().await { if let Ok(resp) = resp.send().await {
response = Some(resp); response = Some(resp);
@ -59,7 +58,6 @@ pub async fn return_http_data(options: &LibOptions) -> HashMap<String, HttpData>
response = Some(resp); response = Some(resp);
break; break;
} }
counter += 1;
} }
} }
} else if let Ok(resp) = https_send_fut.send().await { } else if let Ok(resp) = https_send_fut.send().await {