Improvements to finding idle nodes, last_session actually only shows the last time the remote polled us
This commit is contained in:
@@ -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))));
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user