Cache: warm at array start, extend stale tolerance to 5 min, fix last uptime copy
- ARRAY_START_SCRIPTS: add api_cache_writer.sh so monitor/arrs cache is populated immediately on array start (/tmp is tmpfs — cleared on reboot, so first-boot load was hitting live API for up to 60 seconds until the cron fired) - api/monitor.php + arrs.php: raise cache TTL from 90s to 300s — stale-but-instant beats a 6-second live API wait if the writer is momentarily behind - include/unraid_api.php: replace last inline uptime formatter with vv_format_uptime()
This commit is contained in:
@@ -216,9 +216,8 @@ function vv_local_host_stats(): array {
|
||||
|
||||
$uptimeRaw = $os['uptime'] ?? '';
|
||||
if (is_numeric($uptimeRaw)) {
|
||||
$s = (int)$uptimeRaw;
|
||||
$d = intdiv($s, 86400); $h = intdiv($s % 86400, 3600); $m = intdiv($s % 3600, 60);
|
||||
$uptime = ($d ? "{$d}d " : '') . ($h ? "{$h}h " : '') . "{$m}m";
|
||||
$s = (int)$uptimeRaw;
|
||||
$uptime = vv_format_uptime($s);
|
||||
} else {
|
||||
$s = 0; $uptime = $uptimeRaw ?: '—';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user