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 } indexmap = { version = "1.2", default-features = false }
tokio = "=0.2.0-alpha.6" 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 = "0.1"
tracing-futures = { version = "0.1", features = ["tokio-alpha"], default-features = false } 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. // Construct and then spawn a worker.
let worker = async move { let worker = async move {
use futures::select; use futures::future::{self, Either};
loop { loop {
select! { match future::select(shutdown_rx.next(), worker_rx.next()).await {
_ = shutdown_rx.next() => return, Either::Left((_, _)) => return, // shutdown signal
msg = worker_rx.next() => { Either::Right((None, _)) => return, // all workers are gone
match msg { Either::Right((Some(event), _)) => data2
Some(event) => { .lock()
data2 .expect("mutex should be unpoisoned")
.lock() .update(event),
.expect("mutex should be unpoisoned")
.update(event)
}
None => return,
}
}
} }
} }
}; };

View File

@ -15,7 +15,7 @@ serde = { version = "1", features = ["serde_derive"] }
toml = "0.5" toml = "0.5"
tokio = "=0.2.0-alpha.6" 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 = "0.1"
tracing-futures = { version = "0.1", features = ["tokio-alpha"], default-features = false } tracing-futures = { version = "0.1", features = ["tokio-alpha"], default-features = false }