Improvements to finding idle nodes, last_session actually only shows the last time the remote polled us
All checks were successful
Create Docker Image / Build Docker Image (x86_64) (push) Successful in 47s
Create Docker Image / Build Docker Image (arm64) (push) Successful in 1m53s
Create Docker Image / Final Docker Image Manifest (push) Successful in 10s

This commit is contained in:
2024-09-15 22:00:40 +10:00
parent 832b496b0b
commit 4501443a43
17 changed files with 122 additions and 38 deletions

View File

@@ -2,6 +2,7 @@
namespace App\Models;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Collection;
@@ -181,6 +182,11 @@ class System extends Model
return $val ?: Setup::findOrFail(config('app.id'))->msgs_pkt;
}
public function getLastSeenAttribute(): ?Carbon
{
return $this->logs_recent->first()?->created_at;
}
/* METHODS */
public function echoareas()
@@ -289,7 +295,7 @@ class System extends Model
}
/**
* Return other addresses that are no collected here, but are on the same network as us.
* Return other addresses that are not collected here, but are on the same network as us.
*
* @return \Illuminate\Database\Eloquent\Collection
* @throws \Exception
@@ -298,6 +304,7 @@ class System extends Model
{
$our = our_address();
return $this->akas->filter(fn($item)=>($item->parent() && (! $our->contains($item->parent()))));
return $this->akas
->filter(fn($item)=>(($x=$item->parent()) && (! $our->contains($x)) && ($our->pluck('zone.domain_id')->contains($item->zone->domain_id))));
}
}