Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/bridge/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,15 @@ impl Client {
headers.insert("Accept", HeaderValue::from_static("*/*"));
headers.insert("Connection", HeaderValue::from_static("keep-alive"));
headers.insert("Content-Type", HeaderValue::from_static("application/json"));
let client = ReqwestClient::builder().default_headers(headers).build()?;
// reqwest ships with no default timeout, so a single hung TCP
// connection blocks the caller indefinitely. 30s total / 10s connect
// is far above any healthy response from these APIs while still
// guaranteeing the caller gets control back.
let client = ReqwestClient::builder()
.default_headers(headers)
.connect_timeout(std::time::Duration::from_secs(10))
.timeout(std::time::Duration::from_secs(30))
.build()?;

Ok(Self {
host: Url::parse(host)?,
Expand Down
10 changes: 9 additions & 1 deletion src/clob/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1491,7 +1491,15 @@ impl Client<Unauthenticated> {
headers.insert("Connection", HeaderValue::from_static("keep-alive"));
headers.insert("Content-Type", HeaderValue::from_static("application/json"));

let client = ReqwestClient::builder().default_headers(headers).build()?;
// reqwest ships with no default timeout, so a single hung TCP
// connection blocks the caller indefinitely. 30s total / 10s connect
// is far above any healthy response from these APIs while still
// guaranteeing the caller gets control back.
let client = ReqwestClient::builder()
.default_headers(headers)
.connect_timeout(std::time::Duration::from_secs(10))
.timeout(std::time::Duration::from_secs(30))
.build()?;

let geoblock_host = Url::parse(
config
Expand Down
10 changes: 9 additions & 1 deletion src/data/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,15 @@ impl Client {
headers.insert("Accept", HeaderValue::from_static("*/*"));
headers.insert("Connection", HeaderValue::from_static("keep-alive"));
headers.insert("Content-Type", HeaderValue::from_static("application/json"));
let client = ReqwestClient::builder().default_headers(headers).build()?;
// reqwest ships with no default timeout, so a single hung TCP
// connection blocks the caller indefinitely. 30s total / 10s connect
// is far above any healthy response from these APIs while still
// guaranteeing the caller gets control back.
let client = ReqwestClient::builder()
.default_headers(headers)
.connect_timeout(std::time::Duration::from_secs(10))
.timeout(std::time::Duration::from_secs(30))
.build()?;

Ok(Self {
host: Url::parse(host)?,
Expand Down
10 changes: 9 additions & 1 deletion src/gamma/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,15 @@ impl Client {
headers.insert("Accept", HeaderValue::from_static("*/*"));
headers.insert("Connection", HeaderValue::from_static("keep-alive"));
headers.insert("Content-Type", HeaderValue::from_static("application/json"));
let client = ReqwestClient::builder().default_headers(headers).build()?;
// reqwest ships with no default timeout, so a single hung TCP
// connection blocks the caller indefinitely. 30s total / 10s connect
// is far above any healthy response from these APIs while still
// guaranteeing the caller gets control back.
let client = ReqwestClient::builder()
.default_headers(headers)
.connect_timeout(std::time::Duration::from_secs(10))
.timeout(std::time::Duration::from_secs(30))
.build()?;

Ok(Self {
host: Url::parse(host)?,
Expand Down