aboutsummaryrefslogtreecommitdiffstats
path: root/src/swarm
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-11-04 21:23:37 +0100
committertv <tv@krebsco.de>2026-11-04 21:23:37 +0100
commit2728332fe78ef48aa77761e4ee7aadf4d668903d (patch)
tree234b10dd3f620d91840677472ef157bd29eeb69d /src/swarm
parentcbbaae2846e9bfb12ce1e574c3d65561da063ce8 (diff)
fix: change publisher stops with the runtime
Diffstat (limited to 'src/swarm')
-rw-r--r--src/swarm/changes.rs11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/swarm/changes.rs b/src/swarm/changes.rs
index 0f22f52..a04ce7d 100644
--- a/src/swarm/changes.rs
+++ b/src/swarm/changes.rs
@@ -22,7 +22,7 @@ pub(crate) async fn run_change_publisher(state: AppState) {
let before = last_heads.clone();
let doc = Arc::clone(&state.doc);
- let (heads, paths, conflicts) = tokio::task::spawn_blocking(move || {
+ let looked = tokio::task::spawn_blocking(move || {
let replica = doc.blocking_read();
let heads = replica.heads().to_vec();
if heads == before {
@@ -45,8 +45,13 @@ pub(crate) async fn run_change_publisher(state: AppState) {
}
(heads, paths, conflicts)
})
- .await
- .expect("change publisher task panicked");
+ .await;
+ let (heads, paths, conflicts) = match looked {
+ Ok(looked) => looked,
+ // The runtime is shutting down (the node stops): nothing to publish to.
+ Err(error) if error.is_cancelled() => return,
+ Err(error) => std::panic::resume_unwind(error.into_panic()),
+ };
if heads == last_heads {
continue;