From b0876d0f16912b03a1928007e563f158f6751038 Mon Sep 17 00:00:00 2001 From: Eduard Tolosa Date: Mon, 23 Oct 2023 17:49:01 -0500 Subject: [PATCH] Improve retries logic. --- src/httplib.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/httplib.rs b/src/httplib.rs index 7756dda..75b5041 100644 --- a/src/httplib.rs +++ b/src/httplib.rs @@ -47,8 +47,7 @@ pub async fn return_http_data(options: &LibOptions) -> HashMap async move { if options.retries > 1 { - let mut counter = 0; - while counter < options.retries { + for _ in 0..options.retries { if let Some(resp) = https_send_fut.try_clone() { if let Ok(resp) = resp.send().await { response = Some(resp); @@ -59,7 +58,6 @@ pub async fn return_http_data(options: &LibOptions) -> HashMap response = Some(resp); break; } - counter += 1; } } } else if let Ok(resp) = https_send_fut.send().await {