mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 13:57:58 +00:00
node: exit on GRANDPA voter or BABE authoring error (#3353)
* node: exit on GRANDPA voter or BABE authoring error * node: exit process with non-zero return code when service fails * service: rename infallible task to essential task * service: revert field name changes * core: fix service testnet
This commit is contained in:
committed by
Robert Habermeier
parent
09b57261df
commit
70d716dc48
@@ -223,11 +223,11 @@ fn run_until_exit<T, C, E>(
|
||||
mut runtime: Runtime,
|
||||
service: T,
|
||||
e: E,
|
||||
) -> error::Result<()>
|
||||
where
|
||||
T: Deref<Target=substrate_service::Service<C>> + Future<Item = (), Error = ()> + Send + 'static,
|
||||
C: substrate_service::Components,
|
||||
E: IntoExit,
|
||||
) -> error::Result<()> where
|
||||
T: Deref<Target=substrate_service::Service<C>>,
|
||||
T: Future<Item = (), Error = substrate_service::error::Error> + Send + 'static,
|
||||
C: substrate_service::Components,
|
||||
E: IntoExit,
|
||||
{
|
||||
let (exit_send, exit) = exit_future::signal();
|
||||
|
||||
@@ -238,11 +238,17 @@ fn run_until_exit<T, C, E>(
|
||||
// but we need to keep holding a reference to the global telemetry guard
|
||||
let _telemetry = service.telemetry();
|
||||
|
||||
let _ = runtime.block_on(service.select(e.into_exit()));
|
||||
let service_res = {
|
||||
let exit = e.into_exit().map_err(|_| error::Error::Other("Exit future failed.".into()));
|
||||
let service = service.map_err(|err| error::Error::Service(err));
|
||||
let select = service.select(exit).map(|_| ()).map_err(|(err, _)| err);
|
||||
runtime.block_on(select)
|
||||
};
|
||||
|
||||
exit_send.fire();
|
||||
|
||||
// TODO [andre]: timeout this future #1318
|
||||
let _ = runtime.shutdown_on_idle().wait();
|
||||
|
||||
Ok(())
|
||||
service_res
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user