Say when rsync last moved data, and stop colouring successful runs red

last_sync reads the maintenance orchestrators' run records, and those do git
pull, permissions, cleaners and docker updates on schedule whether or not the
global gate is open — so the page reported a healthy 56-minute "daily sync"
while nothing had transferred since 16 July. Both cards also compared status
against 'success' while being fed 'ok', so every clean run rendered in the
failure colour. Adds the assistant, scoped to the tab.
This commit is contained in:
Gmer4Lfe
2026-08-14 16:50:28 -04:00
parent 2cd1384786
commit 7a3e8dd378
2 changed files with 110 additions and 5 deletions
+22
View File
@@ -143,10 +143,31 @@ $warnGb = (float)($vars['BANDWIDTH_WARN_GB'] ?? 50);
$cutoff = date('Y-m-d', strtotime('-30 days'));
$history = [];
// When rsync last actually moved anything, taken from the whole file rather than the window above.
//
// This is the only record of a transfer. last_sync is built from the orchestrators' run records,
// and those orchestrators do a great deal that is not rsync — git pull, permissions, cleaners, arr
// cleanup, docker updates — and run on their schedule whether or not RSYNC_ENABLED is true. So the
// page could report a healthy 56-minute "daily sync" for a subsystem that had not run in a month,
// which is exactly what it was doing: the last entry here is 2026-07-16, the day the global gate
// was closed for the HOST2 rebuild.
//
// Deliberately outside the 30-day cutoff. The last transfer is 29 days old as this is written and
// would have dropped out of the window within days, taking the page from a wrong answer to no
// answer — which on this question is not an improvement.
$lastTransfer = null;
if (file_exists($bwLog)) {
foreach (file($bwLog, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES) ?: [] as $line) {
$p = explode('|', $line);
if (count($p) < 5) continue;
// Recorded before the cutoff test, and unconditionally: the file is chronological, so the
// last line to pass the shape check is the most recent transfer however old it is.
$lastTransfer = [
'ts' => strtotime($p[0] . ' ' . $p[1]) ?: null,
'profile' => $p[2],
'status' => trim($p[4]),
];
if ($p[0] < $cutoff) continue;
$history[] = [
'date' => $p[0],
@@ -186,6 +207,7 @@ echo json_encode([
'windows' => $base['windows'],
'active' => $base['active'],
'last_sync' => $base['last_sync'],
'last_transfer' => $lastTransfer,
'bw_history' => $history,
'bw_warn_gb' => $warnGb,
'win_arrays' => $winArrays,