summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2025-09-14 23:29:45 +0800
committerlittleblack111 <littleblack11111@gmail.com>2025-09-14 23:29:45 +0800
commit4990c65d254cec6328136af4bd2d05b766b4016e (patch)
tree2fd5b813d2628c7ac04abaa84a24aabf7f75e1fe
parent8968ee8e536d653a4283e900bfaddc1b456eca75 (diff)
fix(httpconnector): retry the actual request in TOO_MANY_REQUESTS
fixup! perf(httpconnector): unified handle_response
-rw-r--r--src/client/connector/httpconnector.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/client/connector/httpconnector.rs b/src/client/connector/httpconnector.rs
index 985d9c0..b8369fe 100644
--- a/src/client/connector/httpconnector.rs
+++ b/src/client/connector/httpconnector.rs
@@ -36,15 +36,16 @@ impl HTTPConnector {
})
}
+ #[allow(clippy::only_used_in_recursion)]
fn handle_response<F: Fn() -> RequestBuilder>(
&self,
- resp: F,
+ req: F,
) -> Result<<HTTPConnector as Connection>::Ok, <HTTPConnector as Connection>::Err> {
- match resp().send() {
+ match req().send() {
Ok(resp) => match resp.status() {
StatusCode::TOO_MANY_REQUESTS => {
sleep(Duration::from_secs(5));
- self.update()
+ self.handle_response(req)
}
status => {
if !status.is_success() {