Skip to content

Commit 2997b16

Browse files
committed
fix:from_client function
1 parent a33a70a commit 2997b16

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

src/async.rs

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -108,16 +108,14 @@ impl<S: Sleeper> AsyncClient<S> {
108108

109109
}
110110

111-
//----------------------------------------not needed since no client struct in async minreq------------------------------------
112-
// pub fn from_client(url: String, client: Client) -> Self {
113-
// AsyncClient {
114-
// url,
115-
// client,
116-
// max_retries: crate::DEFAULT_MAX_RETRIES,
117-
// marker: PhantomData,
118-
// }
119-
// }
120-
//-----------------------------------------------------------------------------------------------
111+
pub fn from_client(url: String, client: Client) -> Self {
112+
AsyncClient {
113+
url,
114+
headers,
115+
max_retries: crate::DEFAULT_MAX_RETRIES,
116+
marker: PhantomData,
117+
}
118+
}
121119
/// Make an HTTP GET request to given URL, deserializing to any `T` that
122120
/// implement [`bitcoin::consensus::Decodable`].
123121
///
@@ -507,8 +505,7 @@ impl<S: Sleeper> AsyncClient<S> {
507505

508506
},
509507
Err(e) => {
510-
// Here you might inspect the error (if possible) to decide whether to retry.
511-
// For simplicity, we retry on any error until max_retries is reached.
508+
512509
if attempts < self.max_retries {
513510
S::sleep(delay).await;
514511
attempts += 1;

0 commit comments

Comments
 (0)