Skip to content

Commit

Permalink
Fix HTTP timeout issue and bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
jeff-hughes committed Mar 3, 2022
1 parent a97afb8 commit a29f0a4
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 9 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

## v2.0.1 (2022-03-03)
- Bug fix release to handle improper timeouts on HTTP requests

## v2.0.0 (2022-02-26)
Shellcaster version 2.0.0 brings many added features and performance improvements, but there are a few breaking changes to the configuration file to be aware of. These are listed below. You can download the default config file from here, to reference when updating your local config: https://raw.githubusercontent.com/jeff-hughes/shellcaster/master/config.toml

Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "shellcaster"
version = "2.0.0"
version = "2.0.1"
authors = ["Jeff Hughes <[email protected]>"]
edition = "2021"
license = "GPL-3.0-or-later"
Expand Down
9 changes: 4 additions & 5 deletions src/downloads.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,18 +58,17 @@ pub fn download_list(
/// Downloads a file to a local filepath, returning DownloadMsg variant
/// indicating success or failure.
fn download_file(mut ep_data: EpData, dest: PathBuf, mut max_retries: usize) -> DownloadMsg {
let agent_builder = ureq::builder();
let agent_builder = ureq::builder()
.timeout_connect(Duration::from_secs(10))
.timeout_read(Duration::from_secs(120));
#[cfg(feature = "native_tls")]
let tls_connector = std::sync::Arc::new(native_tls::TlsConnector::new().unwrap());
#[cfg(feature = "native_tls")]
let agent_builder = agent_builder.tls_connector(tls_connector);
let agent = agent_builder.build();

let request: Result<ureq::Response, ()> = loop {
let response = agent
.get(&ep_data.url)
.timeout(Duration::from_secs(30))
.call();
let response = agent.get(&ep_data.url).call();
match response {
Ok(resp) => break Ok(resp),
Err(_) => {
Expand Down
6 changes: 4 additions & 2 deletions src/feeds.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,17 @@ pub fn check_feed(
/// Given a URL, this attempts to pull the data about a podcast and its
/// episodes from an RSS feed.
fn get_feed_data(url: String, mut max_retries: usize) -> Result<PodcastNoId> {
let agent_builder = ureq::builder();
let agent_builder = ureq::builder()
.timeout_connect(Duration::from_secs(5))
.timeout_read(Duration::from_secs(20));
#[cfg(feature = "native_tls")]
let tls_connector = std::sync::Arc::new(native_tls::TlsConnector::new().unwrap());
#[cfg(feature = "native_tls")]
let agent_builder = agent_builder.tls_connector(tls_connector);
let agent = agent_builder.build();

let request: Result<ureq::Response> = loop {
let response = agent.get(&url).timeout(Duration::from_secs(20)).call();
let response = agent.get(&url).call();
match response {
Ok(resp) => break Ok(resp),
Err(_) => {
Expand Down

0 comments on commit a29f0a4

Please sign in to comment.