mirror of
https://github.com/FliegendeWurst/KIT-ILIAS-downloader.git
synced 2024-08-28 04:04:18 +00:00
Terminate once all tasks are complete
This commit is contained in:
parent
09f69b9efd
commit
7d4b9279ee
38
Cargo.lock
generated
38
Cargo.lock
generated
@ -5,6 +5,7 @@ name = "KIT-ILIAS-downloader"
|
||||
version = "0.2.10"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"futures",
|
||||
"futures-channel",
|
||||
"futures-util",
|
||||
"ignore",
|
||||
@ -374,6 +375,21 @@ dependencies = [
|
||||
"new_debug_unreachable",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "futures"
|
||||
version = "0.3.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9b3b0c040a1fe6529d30b3c5944b280c7f0dcb2930d2c3062bca967b602583d0"
|
||||
dependencies = [
|
||||
"futures-channel",
|
||||
"futures-core",
|
||||
"futures-executor",
|
||||
"futures-io",
|
||||
"futures-sink",
|
||||
"futures-task",
|
||||
"futures-util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "futures-channel"
|
||||
version = "0.3.8"
|
||||
@ -381,6 +397,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4b7109687aa4e177ef6fe84553af6280ef2778bdb7783ba44c9dc3399110fe64"
|
||||
dependencies = [
|
||||
"futures-core",
|
||||
"futures-sink",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -389,6 +406,23 @@ version = "0.3.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "847ce131b72ffb13b6109a221da9ad97a64cbe48feb1028356b836b47b8f1748"
|
||||
|
||||
[[package]]
|
||||
name = "futures-executor"
|
||||
version = "0.3.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4caa2b2b68b880003057c1dd49f1ed937e38f22fcf6c212188a121f08cf40a65"
|
||||
dependencies = [
|
||||
"futures-core",
|
||||
"futures-task",
|
||||
"futures-util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "futures-io"
|
||||
version = "0.3.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "611834ce18aaa1bd13c4b374f5d653e1027cf99b6b502584ff8c9a64413b30bb"
|
||||
|
||||
[[package]]
|
||||
name = "futures-macro"
|
||||
version = "0.3.8"
|
||||
@ -422,9 +456,13 @@ version = "0.3.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d304cff4a7b99cfb7986f7d43fbe93d175e72e704a8860787cc95e9ffd85cbd2"
|
||||
dependencies = [
|
||||
"futures-channel",
|
||||
"futures-core",
|
||||
"futures-io",
|
||||
"futures-macro",
|
||||
"futures-sink",
|
||||
"futures-task",
|
||||
"memchr",
|
||||
"pin-project 1.0.2",
|
||||
"pin-utils",
|
||||
"proc-macro-hack",
|
||||
|
@ -13,6 +13,7 @@ tokio = { version = "0.2", features = ["full"] }
|
||||
serde_json = "1.0.51"
|
||||
scraper = "0.12.0"
|
||||
url = "2.1.1"
|
||||
futures = "0.3.8"
|
||||
futures-util = "0.3.8"
|
||||
futures-channel = "0.3.8"
|
||||
regex = "1.3.7"
|
||||
|
@ -1,4 +1,5 @@
|
||||
use anyhow::{Context, Result, anyhow};
|
||||
use futures::future::{self, Either};
|
||||
use futures_channel::mpsc::UnboundedSender;
|
||||
use futures_util::{StreamExt, stream::TryStreamExt};
|
||||
use ignore::gitignore::Gitignore;
|
||||
@ -94,8 +95,12 @@ async fn main() {
|
||||
},
|
||||
Err(e) => println!("{:?}", e)
|
||||
}
|
||||
while let Some(task) = rx.next().await {
|
||||
let _ = task.await;
|
||||
loop {
|
||||
match future::select(rx.next(), future::ready(())).await {
|
||||
// if the channel is empty, all tasks are completed
|
||||
Either::Left((task, _)) => if let Some(task) = task { let _ = task.await; } else { break },
|
||||
Either::Right(_) => break
|
||||
}
|
||||
}
|
||||
if ilias.opt.content_tree {
|
||||
// restore fast page loading times
|
||||
|
Loading…
Reference in New Issue
Block a user