configurable amount of download threads

This commit is contained in:
OMGeeky
2023-04-07 17:08:26 +02:00
parent 2b017eaee9
commit b28cb4670e
2 changed files with 5 additions and 3 deletions

View File

@@ -1,12 +1,12 @@
[package]
name = "twitch_data"
version = "0.1.6"
version = "0.1.7"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
downloader_config = { git = "https://github.com/OMGeeky/downloader_config" }
downloader_config = { version="0.3.0", git = "https://github.com/OMGeeky/downloader_config" }
exponential_backoff = { git = "https://github.com/OMGeeky/exponential_backoff" }

View File

@@ -537,7 +537,8 @@ impl<'a> TwitchClient<'a> {
url: &String,
folder_path: &PathBuf,
) -> Result<Vec<Option<PathBuf>>> {
let mut amount_of_threads = 100; //TODO: make this configurable (downloader_config)
let config = load_config();
let mut amount_of_threads: u64 = config.twitch_downloader_thread_count;
trace!("downloading all parts of video: {}", url);
let base_url = get_base_url(&url);
info!("getting parts");
@@ -546,6 +547,7 @@ impl<'a> TwitchClient<'a> {
info!("getting parts ...Done");
let amount_of_parts = parts.len();
let amount_of_parts = amount_of_parts as u64;
info!("part count: {}", amount_of_parts);
if amount_of_parts < 1 {
return Err(DownloadError::new("No parts found").into());