Fix this up

This commit is contained in:
Lance Pioch 2024-04-19 21:59:11 -04:00
parent d30accbc71
commit 367b9bd154

View File

@ -303,17 +303,17 @@ class Node extends Model
public function ipAddresses(): array public function ipAddresses(): array
{ {
return cache()->remember("nodes.$this->id.servers", now()->addHour(), function () { return cache()->remember("nodes.$this->id.ips", now()->addHour(), function () {
$ips = collect(); $ips = collect();
if (is_ip($this->fqdn)) { if (is_ip($this->fqdn)) {
$ips->push($this->fqdn); $ips = $ips->push($this->fqdn);
} elseif ($dnsRecords = gethostbynamel($this->fqdn)) { } elseif ($dnsRecords = gethostbynamel($this->fqdn)) {
$ips->concat($dnsRecords); $ips = $ips->concat($dnsRecords);
} }
try { try {
$addresses = Http::daemon($this)->connectTimeout(1)->timeout(1)->get('/api/system/ips')->json(); $addresses = Http::daemon($this)->connectTimeout(1)->timeout(1)->get('/api/system/ips')->json();
$ips->concat(fluent($addresses)->get('ip_addresses')); $ips = $ips->concat(fluent($addresses)->get('ip_addresses'));
} catch (Exception) { } catch (Exception) {
// pass // pass
} }