Skip daemon RPC calls for servers on maintenance-mode nodes (#2371)

This commit is contained in:
stdpi
2026-06-11 18:05:47 +07:00
committed by GitHub
parent 1bd4492cdc
commit cc2aa38ad4

View File

@@ -457,6 +457,10 @@ class Server extends Model implements HasAvatar, Validatable
public function retrieveStatus(): ContainerStatus
{
if ($this->node->isUnderMaintenance()) {
return ContainerStatus::Missing;
}
return cache()->remember("servers.$this->uuid.status", now()->addSeconds(15), function () {
// @phpstan-ignore myCustomRules.forbiddenGlobalFunctions
$details = app(DaemonServerRepository::class)->setServer($this)->getDetails();
@@ -470,6 +474,10 @@ class Server extends Model implements HasAvatar, Validatable
*/
public function retrieveResources(): array
{
if ($this->node->isUnderMaintenance()) {
return [];
}
return cache()->remember("servers.$this->uuid.resources", now()->addSeconds(15), function () {
// @phpstan-ignore myCustomRules.forbiddenGlobalFunctions
$details = app(DaemonServerRepository::class)->setServer($this)->getDetails();