Cache the watchdog payload, and stop reading trailing comments as conf values

The tab collected over SSH on every 30s poll — 8.3s a load with HOST2 down.
vv_parse_conf_scalar() captured to end of line, so a commented toggle parsed as
"true   # HOST2 back online": every threshold read right because (int) stops at
the first non-digit, and 38 booleans read wrong. The Fallback tab has been
showing failover disabled while it was on.
This commit is contained in:
Gmer4Lfe
2026-08-14 10:45:17 -04:00
parent 8808cbfc04
commit 1f4b751fbb
5 changed files with 100 additions and 10 deletions
+12
View File
@@ -270,6 +270,17 @@ function _systemCard(node, cfg) {
: sys.load1 > sys.cores * cfg.rw_load_soft ? '#ffb74d'
: '#4caf50';
// The fourth member of SYSTEM_WATCHDOG_SCRIPTS, and the only one with nothing to show: it keeps
// the persistent backup of the partner's conf current, and writes no state until it does. Drawn
// as its gate rather than left off the card, because a chain member that is simply missing from
// the page reads as one that is fine — the same reason an unreachable node here says so instead
// of rendering healthy. Names the switch, so "why is it off" does not need a hunt through conf.
const confCacheHtml = !cfg.fallback_on
? '<span style="color:#555;">off — FALLBACK_ENABLED</span>'
: !cfg.conf_sync_on
? '<span style="color:#7a6a20;">off — CONF_SYNC_ENABLED</span>'
: '<span style="color:#4caf50;">active</span>';
const apiOnly = sys.api_only === true;
const daemonDot = sys.daemon_ok === null ? '#555' : sys.daemon_ok ? '#4caf50' : '#ef5350';
const daemonTxt = sys.daemon_ok === null ? '—' : sys.daemon_ok ? 'daemon ok' : 'daemon err';
@@ -302,6 +313,7 @@ function _systemCard(node, cfg) {
<div style="height:5px"></div>` : ''}
${_row('Uptime', sys.uptime ? _dur(sys.uptime) : '—')}
${_row('Docker', `<span style="color:${daemonDot}">${daemonTxt}</span>`)}
${_row('Conf cache', confCacheHtml)}
${!apiOnly ? (sys.oom_count > 0 ? _row('OOM kills', `<span style="color:#ef5350">${sys.oom_count}</span>`) : _row('OOM kills', '<span style="color:#333">0</span>')) : ''}
${apiOnly ? `<div style="font-size:10px;color:#333;margin-top:6px;">Watchdog state unavailable — SSH not configured</div>` : ''}
</div>`;