Remove tokio dependencies (#2935)

* Remove dependencies on tokio

* Make service not depend on tokio

* Fix service tests

* Manually poll the import queue if failed to start

* Spawn all tasks at the end

* Remove executor from TelemetryOnConnect

* Remove TaskExecutor from offchain workers

* Remove TaskExecutor from AuthoritySetup

* Remove TaskExecutor from service

* Remove tokio dependency from RPC

* Remove finality-grandpa from WASM checks

* Fix offchain tests

* Line widths

* Fix RPC tests

* Fix service tests

* Fix bad futures polling

* Address some concerns

* Better error handling

* Is it the connectivity test that's not passing? I don't know, let's try

* Revert "Is it the connectivity test that's not passing? I don't know, let's try"

This reverts commit 28bbe51f0e2e4885fe1f901e11078604604cb212.

* Fix test
This commit is contained in:
Pierre Krieger
2019-06-26 17:21:17 +02:00
committed by Bastian Köcher
parent f69c48c7b8
commit 1b73b6532a
26 changed files with 287 additions and 154 deletions
+5 -8
View File
@@ -116,12 +116,12 @@ impl<B: Block> Link<B> for WaitLink {
}
}
/// Import blocks from a binary stream.
/// Returns a future that import blocks from a binary stream.
pub fn import_blocks<F, E, R>(
mut config: FactoryFullConfiguration<F>,
exit: E,
mut input: R
) -> error::Result<()>
) -> error::Result<impl Future<Item = (), Error = ()>>
where F: ServiceFactory, E: Future<Item=(),Error=()> + Send + 'static, R: Read,
{
let client = new_client::<F>(&config)?;
@@ -175,7 +175,7 @@ pub fn import_blocks<F, E, R>(
}
let mut link = WaitLink::new();
tokio::run(futures::future::poll_fn(move || {
Ok(futures::future::poll_fn(move || {
let blocks_before = link.imported_blocks;
queue.poll_actions(&mut link);
if link.imported_blocks / 1000 != blocks_before / 1000 {
@@ -186,15 +186,12 @@ pub fn import_blocks<F, E, R>(
);
}
if link.imported_blocks >= count {
info!("Imported {} blocks. Best: #{}", block_count, client.info().chain.best_number);
Ok(Async::Ready(()))
} else {
Ok(Async::NotReady)
}
}));
info!("Imported {} blocks. Best: #{}", block_count, client.info().chain.best_number);
Ok(())
}))
}
/// Revert the chain.