Remote cache: extend to monitor stats; vv_local_host_stats(), 2h bg refresh covers monitor+arrs pages
This commit is contained in:
@@ -613,6 +613,18 @@ function vv_remote_hosts_stats(): array {
|
||||
$results = [];
|
||||
foreach ($hostIds as $id) {
|
||||
if (strtolower($id) === strtolower($myHost)) continue;
|
||||
// Background cache written by remote_arr_cache_writer.sh every 2h — use it if present.
|
||||
$bgCache = VV_CACHE_DIR . '/monitor_remote_' . strtolower($id) . '.json';
|
||||
if (file_exists($bgCache)) {
|
||||
$cached = json_decode(file_get_contents($bgCache), true);
|
||||
if ($cached) {
|
||||
$cached['cache_age'] = time() - (int)filemtime($bgCache);
|
||||
$results[$id] = $cached;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// No background cache yet — fall back to live call (uses 30s inline cache).
|
||||
$key = $vars[strtoupper($id) . '_UNRAID_API_KEY'] ?? '';
|
||||
if (!$key) {
|
||||
$results[$id] = ['available' => false, 'no_api_key' => true,
|
||||
|
||||
Reference in New Issue
Block a user