aboutsummaryrefslogtreecommitdiffstats
path: root/src/state
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-11-01 20:34:59 +0100
committertv <tv@krebsco.de>2026-11-01 20:34:59 +0100
commit962fe4b43632822dc91fa6a4da6f6f295f4dba32 (patch)
tree5dd0b5c144f9e2e93ea498cab1df9d2295d49f70 /src/state
parentbb0716c8f199f7efb0f89a711a649f89cb09931f (diff)
bootstrap: replace pull by progress notify
Diffstat (limited to 'src/state')
-rw-r--r--src/state/host.rs2
-rw-r--r--src/state/mod.rs4
2 files changed, 6 insertions, 0 deletions
diff --git a/src/state/host.rs b/src/state/host.rs
index e7921e4..5751998 100644
--- a/src/state/host.rs
+++ b/src/state/host.rs
@@ -330,6 +330,7 @@ impl Host for AppState {
.expect("rejoin task panicked")
};
state.publish_change();
+ state.join_progress.notify_one();
if resumed {
crate::swarm::peer::announce(&state);
}
@@ -360,6 +361,7 @@ impl Host for AppState {
.expect("rejoin task panicked")
};
state.after_epoch_switch().await;
+ state.join_progress.notify_one();
if resumed {
crate::swarm::peer::announce(&state);
}
diff --git a/src/state/mod.rs b/src/state/mod.rs
index 7c1299f..2902234 100644
--- a/src/state/mod.rs
+++ b/src/state/mod.rs
@@ -151,6 +151,9 @@ pub(crate) struct AppState {
/// Something the neighbours are computed from may have changed: the member list or a
/// peer's state (`swarm::topology::run_worker`, `swarm::topology::change_peer`).
pub(crate) topology_changed: Arc<tokio::sync::Notify>,
+ /// Something a joining node waits for may have happened: the swarm ID learned, the
+ /// initial sync done, a rejoin ended, a seed found (`swarm::bootstrap`).
+ pub(crate) join_progress: Arc<tokio::sync::Notify>,
/// While rejoining a newer epoch, the previous document, served read-only (and
/// marked stale) instead of answering 503.
@@ -276,6 +279,7 @@ impl AppState {
discovered_swarm_id: Some(swarm_id),
};
debug!("Node transitioned from {old_lifecycle:?} {lifecycle:?}");
+ self.join_progress.notify_one();
Ok(())
}
NodeLifecycle::Joining {