Skip to content
Snippets Groups Projects
Commit 6431cdf6 authored by Pierre Krieger's avatar Pierre Krieger Committed by Gavin Wood
Browse files

Remove TaskExecutor from the API of the informant (#2642)

* Remove TaskExecutor from the API of the informant

* Fix node-template
parent 3860d7c8
No related merge requests found
......@@ -32,9 +32,16 @@ use runtime_primitives::generic::BlockId;
use runtime_primitives::traits::{Header, SaturatedConversion};
/// Spawn informant on the event loop
#[deprecated(note = "Please use informant::build instead, and then create the task manually")]
pub fn start<C>(service: &Service<C>, exit: ::exit_future::Exit, handle: TaskExecutor) where
C: Components,
{
handle.spawn(exit.until(build(service)).map(|_| ()));
}
/// Creates an informant in the form of a `Future` that must be polled regularly.
pub fn build<C>(service: &Service<C>) -> impl Future<Item = (), Error = ()>
where C: Components {
let network = service.network();
let client = service.client();
let txpool = service.transaction_pool();
......@@ -156,8 +163,8 @@ pub fn start<C>(service: &Service<C>, exit: ::exit_future::Exit, handle: TaskExe
Ok(())
});
let informant_work = display_notifications.join3(display_block_import, display_txpool_import);
handle.spawn(exit.until(informant_work).map(|_| ()));
display_notifications.join3(display_block_import, display_txpool_import)
.map(|((), (), ())| ())
}
fn speed(best_number: u64, last_number: Option<u64>, last_update: time::Instant) -> String {
......
......@@ -61,8 +61,8 @@ fn run_until_exit<T, C, E>(
{
let (exit_send, exit) = exit_future::signal();
let executor = runtime.executor();
informant::start(&service, exit.clone(), executor.clone());
let informant = informant::build(&service);
runtime.executor().spawn(exit.until(informant).map(|_| ()));
let _ = runtime.block_on(e.into_exit());
exit_send.fire();
......
......@@ -118,8 +118,8 @@ fn run_until_exit<T, C, E>(
{
let (exit_send, exit) = exit_future::signal();
let executor = runtime.executor();
cli::informant::start(&service, exit.clone(), executor.clone());
let informant = cli::informant::build(&service);
runtime.executor().spawn(exit.until(informant).map(|_| ()));
let _ = runtime.block_on(e.into_exit());
exit_send.fire();
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment