Skip to content

Commit 774de59

Browse files
committed
Auto merge of #596 - Mark-Simulacrum:retry-timeout, r=Mark-Simulacrum
Retry timeout rust-lang/rust#92413 (comment) failed due to a request timeout, plausibly because of a parallel request (e.g., metrics) which locked out the database for long enough to cause a failure. This changes our retry logic to hopefully always retry timed out requests. (It does not take the step we took with docker builds of unilaterally retrying *all* requests, but that may be a better path rather than trying to guess... for now this seems a more limited answer).
2 parents cf518f6 + a2f3b39 commit 774de59

File tree

1 file changed

+1
-12
lines changed

1 file changed

+1
-12
lines changed

src/agent/api.rs

+1-12
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ use reqwest::header::AUTHORIZATION;
1111
use reqwest::{Method, StatusCode};
1212
use serde::de::DeserializeOwned;
1313
use serde_json::json;
14-
use std::error::Error as _;
1514

1615
#[derive(Debug, Fail)]
1716
pub enum AgentApiError {
@@ -93,17 +92,7 @@ impl AgentApi {
9392
let retry = if let Some(AgentApiError::ServerUnavailable) = err.downcast_ref() {
9493
true
9594
} else if let Some(err) = err.downcast_ref::<::reqwest::Error>() {
96-
let reqwest_io = err
97-
.source()
98-
.map(|inner| inner.is::<::std::io::Error>())
99-
.unwrap_or(false);
100-
let hyper_io = err
101-
.source()
102-
.and_then(|inner| inner.downcast_ref::<::hyper::Error>())
103-
.and_then(|inner| inner.source())
104-
.map(|inner| inner.is::<::std::io::Error>())
105-
.unwrap_or(false);
106-
reqwest_io || hyper_io
95+
err.is_timeout() || err.is_connect()
10796
} else {
10897
false
10998
};

0 commit comments

Comments
 (0)