aboutsummaryrefslogtreecommitdiffstats
path: root/src/swarm/working_links.rs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-12-01 06:10:15 +0000
committertv <tv@krebsco.de>2026-12-01 06:10:15 +0000
commit82bb426dcd22268a960d35d7b8c947b864a6ddf5 (patch)
treeb407d8e840666b681d7b04d8b8e3b49e75b42ea6 /src/swarm/working_links.rs
parent81aa0ea92fbb9a84b484f9f9cf739047108e7697 (diff)
swarm: the peer worker's periodic checks run when something happened, and rarely when quietHEADmaster
Every five seconds the peer worker looked at the forget records, the member registry, stability, whom the node reaches, its links, its clock, its measurements and the state file. It now looks five seconds after the document or a peer's state changed, every five seconds while something of these is under way (the node not ready or catching up, a forget record not acted on, a link's change not settled, the tier after a restart not decided, a neighbour not reached), and once a minute otherwise, for what changes with time alone. Stability takes two measurements more than two minutes apart for the node not having run.
Diffstat (limited to 'src/swarm/working_links.rs')
-rw-r--r--src/swarm/working_links.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/swarm/working_links.rs b/src/swarm/working_links.rs
index ca3a22b..9ccfaa1 100644
--- a/src/swarm/working_links.rs
+++ b/src/swarm/working_links.rs
@@ -141,6 +141,13 @@ pub(crate) fn settled(state: &AppState) -> (u64, bool) {
(pending.checks, pending.since.is_empty())
}
+/// Whether no link's change waits to be recorded, and no member is being asked about
+/// one: nothing of `check` waits on time.
+pub(crate) fn quiet(state: &AppState) -> bool {
+ let pending = state.working_links.lock_or_recover();
+ pending.since.is_empty() && pending.probes.is_empty()
+}
+
/// With the peer worker's periodic pass (every 5 s): whom we reach now, against the
/// member list's graph and our record; a difference that held for long enough goes into
/// the record.