diff --git a/extensions/Servers/Proxmox/Livewire/Server.php b/extensions/Servers/Proxmox/Livewire/Server.php index a16107d76..d778bcaf3 100644 --- a/extensions/Servers/Proxmox/Livewire/Server.php +++ b/extensions/Servers/Proxmox/Livewire/Server.php @@ -11,18 +11,12 @@ use Illuminate\Support\Facades\Cache; class Server extends Component { protected int $maxRetries = 3; + public int $loadAttempts = 0; public function mount(ServerModel $server): void { parent::mount($server); - - // Retry loading VM status if initial load failed - $retries = 0; - while ($this->status === null && $retries < $this->maxRetries) { - usleep(100000); // 100ms delay between retries - $this->loadVmStatus(); - $retries++; - } + $this->loadAttempts = 1; // Check and enforce bandwidth throttling if exceeded (only if status loaded) if ($this->status !== null) { @@ -177,13 +171,28 @@ class Server extends Component public function retryLoadStatus(): void { - $retries = 0; - while ($this->status === null && $retries < $this->maxRetries) { + $this->loadAttempts++; + $this->loadVmStatus(); + + // Check bandwidth throttling on successful load + if ($this->status !== null) { + $this->checkAndEnforceBandwidthLimit(); + } + } + + /** + * Auto-retry loading status via polling (called by wire:poll when status is null) + */ + public function autoRetryLoadStatus(): void + { + if ($this->status === null && $this->loadAttempts < $this->maxRetries) { + $this->loadAttempts++; $this->loadVmStatus(); - if ($this->status === null) { - usleep(200000); // 200ms delay between retries + + // Check bandwidth throttling on successful load + if ($this->status !== null) { + $this->checkAndEnforceBandwidthLimit(); } - $retries++; } } diff --git a/extensions/Servers/Proxmox/views/server.blade.php b/extensions/Servers/Proxmox/views/server.blade.php index e7484f111..36c698192 100644 --- a/extensions/Servers/Proxmox/views/server.blade.php +++ b/extensions/Servers/Proxmox/views/server.blade.php @@ -1,4 +1,4 @@ -