mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 04:37:57 +00:00
node: fix shutdown (#1308)
* node: remove grandpa authority flags * node: exit-guard grandpa and aura spawned futures * node: wait for futures to stop running on shutdown * core: run connectivity tests on same ports * core: pass on_exit future when starting aura and grandpa * node: add issue number to todo * core: fix aura and grandpa tests
This commit is contained in:
committed by
Robert Habermeier
parent
ef8b94656e
commit
f8f932d123
@@ -50,6 +50,7 @@ pub mod chain_spec;
|
||||
mod service;
|
||||
mod params;
|
||||
|
||||
use tokio::prelude::Future;
|
||||
use tokio::runtime::Runtime;
|
||||
pub use cli::{VersionInfo, IntoExit};
|
||||
use substrate_service::{ServiceFactory, Roles as ServiceRoles};
|
||||
@@ -136,8 +137,8 @@ pub fn run<I, T, E>(args: I, exit: E, version: cli::VersionInfo) -> error::Resul
|
||||
let mut runtime = Runtime::new()?;
|
||||
let executor = runtime.executor();
|
||||
match config.roles == ServiceRoles::LIGHT {
|
||||
true => run_until_exit(&mut runtime, service::Factory::new_light(config, executor)?, exit)?,
|
||||
false => run_until_exit(&mut runtime, service::Factory::new_full(config, executor)?, exit)?,
|
||||
true => run_until_exit(runtime, service::Factory::new_light(config, executor)?, exit)?,
|
||||
false => run_until_exit(runtime, service::Factory::new_full(config, executor)?, exit)?,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -145,7 +146,7 @@ pub fn run<I, T, E>(args: I, exit: E, version: cli::VersionInfo) -> error::Resul
|
||||
}
|
||||
|
||||
fn run_until_exit<T, C, E>(
|
||||
runtime: &mut Runtime,
|
||||
mut runtime: Runtime,
|
||||
service: T,
|
||||
e: E,
|
||||
) -> error::Result<()>
|
||||
@@ -161,5 +162,14 @@ fn run_until_exit<T, C, E>(
|
||||
|
||||
let _ = runtime.block_on(e.into_exit());
|
||||
exit_send.fire();
|
||||
|
||||
// we eagerly drop the service so that the internal exit future is fired,
|
||||
// but we need to keep holding a reference to the global telemetry guard
|
||||
let _telemetry = service.telemetry();
|
||||
drop(service);
|
||||
|
||||
// TODO [andre]: timeout this future #1318
|
||||
let _ = runtime.shutdown_on_idle().wait();
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user