Remove async-await feature of futures.

This commit is contained in:
Henry de Valence 2019-10-11 10:25:58 -07:00 committed by Deirdre Connolly
parent 373a8fbcfd
commit fc872ea03f
3 changed files with 10 additions and 16 deletions

View File

@ -21,7 +21,7 @@ pin-project = "0.4"
indexmap = { version = "1.2", default-features = false }
tokio = "=0.2.0-alpha.6"
futures-preview = { version = "=0.3.0-alpha.19", features = ["async-await"] }
futures-preview = "=0.3.0-alpha.19"
tracing = "0.1"
tracing-futures = { version = "0.1", features = ["tokio-alpha"], default-features = false }

View File

@ -87,21 +87,15 @@ impl TimestampCollector {
// Construct and then spawn a worker.
let worker = async move {
use futures::select;
use futures::future::{self, Either};
loop {
select! {
_ = shutdown_rx.next() => return,
msg = worker_rx.next() => {
match msg {
Some(event) => {
data2
.lock()
.expect("mutex should be unpoisoned")
.update(event)
}
None => return,
}
}
match future::select(shutdown_rx.next(), worker_rx.next()).await {
Either::Left((_, _)) => return, // shutdown signal
Either::Right((None, _)) => return, // all workers are gone
Either::Right((Some(event), _)) => data2
.lock()
.expect("mutex should be unpoisoned")
.update(event),
}
}
};

View File

@ -15,7 +15,7 @@ serde = { version = "1", features = ["serde_derive"] }
toml = "0.5"
tokio = "=0.2.0-alpha.6"
futures-preview = { version = "=0.3.0-alpha.19", features = ["async-await"] }
futures-preview = "=0.3.0-alpha.19"
tracing = "0.1"
tracing-futures = { version = "0.1", features = ["tokio-alpha"], default-features = false }