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
+5
-1
@@ -69,11 +69,12 @@ impl NodeStatusCacheRefresher {
|
||||
pub async fn run(&mut self, shutdown_token: ShutdownToken) {
|
||||
let mut last_update = OffsetDateTime::now_utc();
|
||||
let mut fallback_interval = time::interval(self.fallback_caching_interval);
|
||||
while !shutdown_token.is_cancelled() {
|
||||
loop {
|
||||
tokio::select! {
|
||||
biased;
|
||||
_ = shutdown_token.cancelled() => {
|
||||
trace!("NodeStatusCacheRefresher: Received shutdown");
|
||||
break;
|
||||
}
|
||||
// Update node status cache when the contract cache / describe cache is updated
|
||||
Ok(_) = self.mixnet_contract_cache_listener.changed() => {
|
||||
@@ -81,6 +82,7 @@ impl NodeStatusCacheRefresher {
|
||||
_ = self.maybe_refresh(&mut fallback_interval, &mut last_update) => (),
|
||||
_ = shutdown_token.cancelled() => {
|
||||
trace!("NodeStatusCacheRefresher: Received shutdown");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -89,6 +91,7 @@ impl NodeStatusCacheRefresher {
|
||||
_ = self.maybe_refresh(&mut fallback_interval, &mut last_update) => (),
|
||||
_ = shutdown_token.cancelled() => {
|
||||
trace!("NodeStatusCacheRefresher: Received shutdown");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -99,6 +102,7 @@ impl NodeStatusCacheRefresher {
|
||||
_ = self.maybe_refresh(&mut fallback_interval, &mut last_update) => (),
|
||||
_ = shutdown_token.cancelled() => {
|
||||
trace!("NodeStatusCacheRefresher: Received shutdown");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user