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]]
|
||||
name = "mangafetchi"
|
||||
version = "0.1.2"
|
||||
version = "0.1.3"
|
||||
dependencies = [
|
||||
"quick-xml",
|
||||
"reqwest",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "mangafetchi"
|
||||
version = "0.1.2"
|
||||
version = "0.1.3"
|
||||
authors = ["blank X <theblankx@protonmail.com>"]
|
||||
edition = "2018"
|
||||
|
||||
|
|
|
@ -65,14 +65,18 @@ pub async fn run(mut args: env::Args) {
|
|||
}
|
||||
if !to_extend.is_empty() {
|
||||
cloned_mutex.lock().await.extend(to_extend);
|
||||
}
|
||||
if handles.is_none() {
|
||||
handles = Some(summon_handles(client.clone(), cloned_mutex).await);
|
||||
}
|
||||
}
|
||||
}
|
||||
if handles.is_some() {
|
||||
for handle in handles.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<()>> {
|
||||
|
|
Loading…
Reference in New Issue