From 7a3e8dd378be63733eea2201bf09757c522e67eb Mon Sep 17 00:00:00 2001 From: Gmer4Lfe Date: Fri, 14 Aug 2026 16:50:28 -0400 Subject: [PATCH] Say when rsync last moved data, and stop colouring successful runs red MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- Plugin/unraid/api/rsync.php | 22 +++++++++ Plugin/unraid/pages/rsync.php | 93 +++++++++++++++++++++++++++++++++-- 2 files changed, 110 insertions(+), 5 deletions(-) diff --git a/Plugin/unraid/api/rsync.php b/Plugin/unraid/api/rsync.php index 9c56291..9ffa0f7 100644 --- a/Plugin/unraid/api/rsync.php +++ b/Plugin/unraid/api/rsync.php @@ -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, diff --git a/Plugin/unraid/pages/rsync.php b/Plugin/unraid/pages/rsync.php index 7e29e42..1bff33f 100644 --- a/Plugin/unraid/pages/rsync.php +++ b/Plugin/unraid/pages/rsync.php @@ -37,6 +37,7 @@ // api/flag_toggle.php enable/disable toggles // api/confform.php inline conf edits require_once dirname(__DIR__) . '/include/confui.php'; +require_once dirname(__DIR__) . '/include/ai_chat.php'; ?>