mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-15 16:11:05 +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
@@ -179,16 +179,15 @@ pub fn start_aura_thread<B, C, E, I, SO, Error>(
|
||||
}
|
||||
};
|
||||
|
||||
runtime.spawn(start_aura(
|
||||
let _ = runtime.block_on(start_aura(
|
||||
slot_duration,
|
||||
local_key,
|
||||
client,
|
||||
block_import,
|
||||
env,
|
||||
sync_oracle,
|
||||
on_exit,
|
||||
));
|
||||
|
||||
runtime.block_on(on_exit).expect("Exit future should not fail");
|
||||
});
|
||||
}
|
||||
|
||||
@@ -200,6 +199,7 @@ pub fn start_aura<B, C, E, I, SO, Error>(
|
||||
block_import: Arc<I>,
|
||||
env: Arc<E>,
|
||||
sync_oracle: SO,
|
||||
on_exit: impl Future<Item=(),Error=()>,
|
||||
) -> impl Future<Item=(),Error=()> where
|
||||
B: Block,
|
||||
C: Authorities<B> + ChainHead<B>,
|
||||
@@ -352,7 +352,7 @@ pub fn start_aura<B, C, E, I, SO, Error>(
|
||||
})
|
||||
};
|
||||
|
||||
future::loop_fn((), move |()| {
|
||||
let work = future::loop_fn((), move |()| {
|
||||
let authorship_task = ::std::panic::AssertUnwindSafe(make_authorship());
|
||||
authorship_task.catch_unwind().then(|res| {
|
||||
match res {
|
||||
@@ -369,7 +369,9 @@ pub fn start_aura<B, C, E, I, SO, Error>(
|
||||
|
||||
Ok(future::Loop::Continue(()))
|
||||
})
|
||||
})
|
||||
});
|
||||
|
||||
work.select(on_exit).then(|_| Ok(()))
|
||||
}
|
||||
|
||||
// a header which has been checked
|
||||
@@ -760,6 +762,7 @@ mod tests {
|
||||
client,
|
||||
environ.clone(),
|
||||
DummyOracle,
|
||||
futures::empty(),
|
||||
);
|
||||
|
||||
runtime.spawn(aura);
|
||||
|
||||
Reference in New Issue
Block a user