Remove more instances of futures01 (#4633)

* Start removing last few instances of futures01

* Use to_poll on wasm

* Revert "Use to_poll on wasm"

This reverts commit 1c61728f10d520df5f9b28c415a0db68e478b9c7.

* Fix fg test

* Upgrade network test futures

* Update offchain hyper version

* Update service test

* bump tokio to 0.2.10

* Removed some unneeded tokios

* fixes

* fix run_until_all_full

* Make service test debuggable

* Update client/offchain/src/api/http.rs

Co-Authored-By: Demi Obenour <48690212+DemiMarie-parity@users.noreply.github.com>

* Add service_test to test-int output

* nitpicking

* Finally fix test

* Give up and revert client/serviec/test

* Revert gitlab ci too

Co-authored-by: Demi Obenour <demi@parity.io>
This commit is contained in:
Ashley
2020-02-28 17:02:33 +01:00
committed by GitHub
parent c1bf4702e2
commit 9a925faf7d
16 changed files with 366 additions and 435 deletions
+4 -2
View File
@@ -116,6 +116,8 @@ pub struct Service<TBl, TCl, TSc, TNetStatus, TNet, TTxPool, TOc> {
marker: PhantomData<TBl>,
}
impl<TBl, TCl, TSc, TNetStatus, TNet, TTxPool, TOc> Unpin for Service<TBl, TCl, TSc, TNetStatus, TNet, TTxPool, TOc> {}
/// Alias for a an implementation of `futures::future::Executor`.
pub type TaskExecutor = Arc<dyn Spawn + Send + Sync>;
@@ -229,7 +231,7 @@ impl<TBl, TBackend, TExec, TRtApi, TSc, TExPool, TOc> AbstractService for
Service<TBl, Client<TBackend, TExec, TBl, TRtApi>, TSc, NetworkStatus<TBl>,
NetworkService<TBl, TBl::Hash>, TExPool, TOc>
where
TBl: BlockT + Unpin,
TBl: BlockT,
TBackend: 'static + sc_client_api::backend::Backend<TBl>,
TExec: 'static + sc_client::CallExecutor<TBl> + Send + Sync + Clone,
TRtApi: 'static + Send + Sync,
@@ -328,7 +330,7 @@ where
}
}
impl<TBl: Unpin, TCl, TSc: Unpin, TNetStatus, TNet, TTxPool, TOc> Future for
impl<TBl, TCl, TSc, TNetStatus, TNet, TTxPool, TOc> Future for
Service<TBl, TCl, TSc, TNetStatus, TNet, TTxPool, TOc>
{
type Output = Result<(), Error>;
+9 -20
View File
@@ -122,28 +122,17 @@ mod tests {
let (tx, rx) = mpsc::unbounded();
status_sinks.push(Duration::from_millis(100), tx);
let mut runtime = tokio::runtime::Runtime::new().unwrap();
let mut val_order = 5;
runtime.spawn(futures::future::poll_fn(move |cx| {
status_sinks.poll(cx, || { val_order += 1; val_order });
Poll::<()>::Pending
}));
let done = rx
.into_future()
.then(|(item, rest)| {
assert_eq!(item, Some(6));
rest.into_future()
futures::executor::block_on(futures::future::select(
futures::future::poll_fn(move |cx| {
status_sinks.poll(cx, || { val_order += 1; val_order });
Poll::<()>::Pending
}),
Box::pin(async {
let items: Vec<i32> = rx.take(3).collect().await;
assert_eq!(items, [6, 7, 8]);
})
.then(|(item, rest)| {
assert_eq!(item, Some(7));
rest.into_future()
})
.map(|(item, _)| {
assert_eq!(item, Some(8));
});
runtime.block_on(done);
));
}
}