Skip to content

Commit

Permalink
download_sysext: Set TCP keepalive option
Browse files Browse the repository at this point in the history
The download can hang for longer time if, e.g., the route goes down.
To error out more quickly, enable the TCP keepalive option.
  • Loading branch information
pothos committed Dec 21, 2023
1 parent 79c38ef commit d864a05
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/bin/download_sysext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,12 @@ fn main() -> Result<(), Box<dyn Error>> {
fs::create_dir_all(&temp_dir)?;

// The default policy of reqwest Client supports max 10 attempts on HTTP redirect.
let client = Client::builder().connect_timeout(Duration::from_secs(HTTP_CONN_TIMEOUT)).timeout(Duration::from_secs(DOWNLOAD_TIMEOUT)).redirect(Policy::default()).build()?;
let client = Client::builder()
.tcp_keepalive(Duration::from_secs(HTTP_CONN_TIMEOUT))
.connect_timeout(Duration::from_secs(HTTP_CONN_TIMEOUT))
.timeout(Duration::from_secs(DOWNLOAD_TIMEOUT))
.redirect(Policy::default())
.build()?;

// If input_xml exists, simply read it.
// If not, try to read from payload_url.
Expand Down

0 comments on commit d864a05

Please sign in to comment.