feat: optimize Proxmox statistics loading by preloading data on mount and reducing cache TTL for faster updates
This commit is contained in:
@@ -139,6 +139,10 @@ class Statistics extends Component
|
||||
$this->networkAnalysis['topPorts'] = [];
|
||||
$this->networkAnalysis['security'] = [];
|
||||
}
|
||||
|
||||
// Preload graph data on mount to speed up initial display
|
||||
// This runs in the background while the page is rendering
|
||||
$this->dispatch('proxmox:stats');
|
||||
}
|
||||
|
||||
#[On('proxmox:stats')]
|
||||
@@ -501,7 +505,8 @@ class Statistics extends Component
|
||||
$cacheKey = 'proxmox-stats-' . $this->server->id . '-' . $graphType . '-' . $timeRange . '-' . $aggregation;
|
||||
|
||||
try {
|
||||
$data = Cache::remember($cacheKey, 60, function () use ($timeRange, $aggregation) {
|
||||
// Reduced cache TTL from 60 to 30 seconds for fresher data and faster updates
|
||||
$data = Cache::remember($cacheKey, 30, function () use ($timeRange, $aggregation) {
|
||||
$proxmox = new Proxmox;
|
||||
$stats = $proxmox->request('/nodes/' . $this->server->node->name . '/qemu/' . $this->server->vm_id . '/rrddata', data: [
|
||||
'timeframe' => $timeRange,
|
||||
|
||||
Reference in New Issue
Block a user