Skip to content

Commit

Permalink
fix(http): increase default timeout to 120s (#288)
Browse files Browse the repository at this point in the history
* fix(http): increase default timeout to 120s

* post review fixup
  • Loading branch information
joe-prosser authored Jul 23, 2024
1 parent 2f92e5d commit 6974e10
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Unreleased
- Add `config parse-from-url` command for parsing configuration from a URL
- Increase default http timeout to 120s


# v0.28.0
- Add general fields to `create datasets`
Expand Down
8 changes: 6 additions & 2 deletions api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ use resources::{
};
use serde::{Deserialize, Serialize};
use serde_json::json;
use std::{cell::Cell, fmt::Display, path::Path};
use std::{cell::Cell, fmt::Display, path::Path, time::Duration};
use url::Url;

use crate::resources::{
Expand Down Expand Up @@ -1844,10 +1844,14 @@ impl Endpoints {
}
}

const DEFAULT_HTTP_TIMEOUT_SECONDS: u64 = 120;

fn build_http_client(config: &Config) -> Result<HttpClient> {
let mut builder = HttpClient::builder()
.gzip(true)
.danger_accept_invalid_certs(config.accept_invalid_certificates);
.danger_accept_invalid_certs(config.accept_invalid_certificates)
.timeout(Some(Duration::from_secs(DEFAULT_HTTP_TIMEOUT_SECONDS)));

if let Some(proxy) = config.proxy.clone() {
builder = builder.proxy(Proxy::all(proxy).map_err(Error::BuildHttpClient)?);
}
Expand Down

0 comments on commit 6974e10

Please sign in to comment.