Summon download workers only if data is already in the vector
This commit is contained in:
parent
c781c62261
commit
9eb433c815
|
@ -330,7 +330,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "mangafetchi"
|
name = "mangafetchi"
|
||||||
version = "0.1.2"
|
version = "0.1.3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"quick-xml",
|
"quick-xml",
|
||||||
"reqwest",
|
"reqwest",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "mangafetchi"
|
name = "mangafetchi"
|
||||||
version = "0.1.2"
|
version = "0.1.3"
|
||||||
authors = ["blank X <theblankx@protonmail.com>"]
|
authors = ["blank X <theblankx@protonmail.com>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
|
|
|
@ -65,14 +65,18 @@ pub async fn run(mut args: env::Args) {
|
||||||
}
|
}
|
||||||
if !to_extend.is_empty() {
|
if !to_extend.is_empty() {
|
||||||
cloned_mutex.lock().await.extend(to_extend);
|
cloned_mutex.lock().await.extend(to_extend);
|
||||||
}
|
|
||||||
if handles.is_none() {
|
if handles.is_none() {
|
||||||
handles = Some(summon_handles(client.clone(), cloned_mutex).await);
|
handles = Some(summon_handles(client.clone(), cloned_mutex).await);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if handles.is_some() {
|
||||||
for handle in handles.unwrap() {
|
for handle in handles.unwrap() {
|
||||||
handle.await.unwrap();
|
handle.await.unwrap();
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
eprintln!("Everything has already been downloaded");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn summon_handles(client: reqwest::Client, mutex: Arc<Mutex<Vec<(String, PathBuf, String)>>>) -> Vec<JoinHandle<()>> {
|
async fn summon_handles(client: reqwest::Client, mutex: Arc<Mutex<Vec<(String, PathBuf, String)>>>) -> Vec<JoinHandle<()>> {
|
||||||
|
|
Loading…
Reference in New Issue