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:
Jędrzej Stuczyński
2025-09-10 13:56:39 +01:00
committed by GitHub
parent d3cdaf373b
commit 0ee387d983
125 changed files with 2701 additions and 1927 deletions
+5 -1
View File
@@ -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;
}
}
}