Pass an executor through the Configuration (#4688)

* Pass an executor through the Configuration

* Make tasks_executor mandatory

* Fix tests
This commit is contained in:
Pierre Krieger
2020-01-21 13:06:15 +01:00
committed by Bastian Köcher
parent b7a63e3b77
commit 169a48c0c5
8 changed files with 48 additions and 28 deletions
+5 -1
View File
@@ -98,7 +98,7 @@ pub fn run<I, T, E>(args: I, exit: E, version: sc_cli::VersionInfo) -> error::Re
match parse_and_prepare::<CustomSubcommands, NoCustom, _>(&version, "substrate-node", args) {
ParseAndPrepare::Run(cmd) => cmd.run(load_spec, exit,
|exit, _cli_args, _custom_args, config: Config<_, _>| {
|exit, _cli_args, _custom_args, mut config: Config<_, _>| {
info!("{}", version.name);
info!(" version {}", config.full_version());
info!(" by Parity Technologies, 2017-2019");
@@ -111,6 +111,10 @@ pub fn run<I, T, E>(args: I, exit: E, version: sc_cli::VersionInfo) -> error::Re
.enable_all()
.build()
.map_err(|e| format!("{:?}", e))?;
config.tasks_executor = {
let runtime_handle = runtime.handle().clone();
Some(Box::new(move |fut| { runtime_handle.spawn(fut); }))
};
match config.roles {
ServiceRoles::LIGHT => run_until_exit(
runtime,