aboutsummaryrefslogtreecommitdiffstats
path: root/src/api/dashboard/dashboard.html
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-11-05 02:14:44 +0100
committertv <tv@krebsco.de>2026-11-05 02:14:44 +0100
commitd510e3a7b223b75b5187470432f909665b6cd967 (patch)
treedce84899b17f8c962228843efdbfe95ccaed6a5c /src/api/dashboard/dashboard.html
parent3531e97f1b1d2894538e43b453dc0b5a925c3910 (diff)
dashboard: swarm-wide epoch shine
Diffstat (limited to 'src/api/dashboard/dashboard.html')
-rw-r--r--src/api/dashboard/dashboard.html25
1 files changed, 16 insertions, 9 deletions
diff --git a/src/api/dashboard/dashboard.html b/src/api/dashboard/dashboard.html
index 1bd2a19..1f27544 100644
--- a/src/api/dashboard/dashboard.html
+++ b/src/api/dashboard/dashboard.html
@@ -2017,21 +2017,28 @@ function openDashboard(id) {
requestAnimationFrame(step);
}
// Nodes that entered a new epoch (a remake: `remakes.md`) shine: a golden halo grows
-// from the node and fades, as a breath, larger. Known for this node and its peers
-// (`/peers`: `localEpoch`, each peer's `epoch`); others' epochs the page doesn't see.
-const SHINE_MS = 1600;
+// from the node and fades, as a breath, larger. Their epochs come from `/peers` (this
+// node's, `localEpoch`, and each peer's) and from the links members report
+// (`graph.measured`, each with the epoch its member said it is in), so for every member
+// that reports. Only a later generation than the page knew shines, and only from a
+// report of the last two minutes: a late or older report doesn't make it shine again.
+const SHINE_MS = 1600, SHINE_FRESH_SECS = 120;
const knownEpochs = new Map();
function epochsArrived() {
if (!state) return;
- const current = new Map();
- if (state.peers.localEpoch) current.set(state.node.id, state.peers.localEpoch.id);
+ const seen = [];
+ if (state.peers.localEpoch) seen.push([state.node.id, state.peers.localEpoch, 0]);
for (const [id, peer] of Object.entries(state.peers.peers)) {
- if (peer.epoch) current.set(id, peer.epoch.id);
+ if (peer.epoch) seen.push([id, peer.epoch, 0]);
+ }
+ for (const [id, report] of Object.entries(state.graph.measured)) {
+ if (report.epoch) seen.push([id, report.epoch, report.secsAgo || 0]);
}
- for (const [id, epoch] of current) {
+ for (const [id, epoch, secsAgo] of seen) {
const was = knownEpochs.get(id);
- if (was !== undefined && was !== epoch) shine(id);
- knownEpochs.set(id, epoch);
+ if (was !== undefined && epoch.generation <= was) continue;
+ if (was !== undefined && secsAgo <= SHINE_FRESH_SECS) shine(id);
+ knownEpochs.set(id, epoch.generation);
}
}
function shine(id) {