Feature/cancellation migration (#6014)
* squashing work on using cancellation in nym crates making nym-task wasm compilable removed sending of status messages replaced TaskManager with ShutdownManager in the validator rewarder additional helpers for ShutdownManager simplified ShutdownToken by removing the name field TaskClient => ShutdownToken within all client tasks wip: remove TaskHandle * track all long-living client tasks * add task tracking for most top level tasks within nym-node * improved default builder * split up cancellation module * module documentation and unit tests * nym node fixes and naming consistency * wasm fixes * assert_eq => assert * wasm fixes and made 'run_until_shutdown' take reference instead of ownership * linux-specific fixes to IpPacketRouter * post rebasing fixes for signing monitor * add ShutdownManager constructor to build it from an external token * applying PR review suggestions
This commit is contained in:
committed by
GitHub
parent
d3cdaf373b
commit
0ee387d983
@@ -190,15 +190,15 @@ impl SignersMonitor {
|
||||
}
|
||||
|
||||
pub(crate) async fn run(&mut self) -> anyhow::Result<()> {
|
||||
let shutdown_manager =
|
||||
ShutdownManager::new("nym-signers-monitor").with_default_shutdown_signals()?;
|
||||
let mut shutdown_manager = ShutdownManager::build_new_default()?;
|
||||
let root_token = shutdown_manager.clone_shutdown_token();
|
||||
|
||||
let mut check_interval = interval(self.check_interval);
|
||||
|
||||
while !shutdown_manager.root_token.is_cancelled() {
|
||||
while !root_token.is_cancelled() {
|
||||
tokio::select! {
|
||||
biased;
|
||||
_ = shutdown_manager.root_token.cancelled() => {
|
||||
_ = root_token.cancelled() => {
|
||||
info!("received shutdown");
|
||||
break;
|
||||
}
|
||||
@@ -211,7 +211,6 @@ impl SignersMonitor {
|
||||
}
|
||||
}
|
||||
|
||||
shutdown_manager.close();
|
||||
shutdown_manager.run_until_shutdown().await;
|
||||
|
||||
if let Err(err) = self.send_shutdown_notification().await {
|
||||
|
||||
Reference in New Issue
Block a user