Skip to content

Commit 20a2628

Browse files
authored
fix: retry when error sending request. (#727)
1 parent e7146ef commit 20a2628

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

core/src/client.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1149,7 +1149,7 @@ impl APIClient {
11491149
}
11501150
Err(err) => (
11511151
Error::Request(err.to_string()),
1152-
err.is_timeout() || err.is_connect(),
1152+
err.is_timeout() || err.is_connect() || err.is_request(),
11531153
),
11541154
};
11551155
if !retry {
@@ -1161,7 +1161,7 @@ impl APIClient {
11611161
retries = 0;
11621162
} else if retries == 2 {
11631163
return Err(err.with_context(&format!(
1164-
"{} {} after 3 reties",
1164+
"{} {} after 3 retries",
11651165
request.method(),
11661166
request.url()
11671167
)));
@@ -1183,6 +1183,7 @@ impl APIClient {
11831183
);
11841184
}
11851185
}
1186+
warn!("will retry after 10 seconds");
11861187
sleep(jitter(Duration::from_secs(10))).await;
11871188
}
11881189
}

0 commit comments

Comments
 (0)