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

@@ -60,15 +60,15 @@ class SystemHeartbeat #implements ShouldQueue
// If we havent polled in heatbeat hours, poll system
foreach ($l as $oo) {
if (Job::where('queue','poll')->get()->pluck('command.address.id')->search($oo->id) === FALSE) {
if ((! $oo->system->last_session)
|| ($oo->system->hearbeat && ($oo->system->last_session->addHours($oo->system->heartbeat) < Carbon::now()))
|| ((! $oo->system->hearbeat) && ($oo->role_id < Address::NODE_NN) && ($oo->system->last_session->addHours(6) < Carbon::now())))
if ((! $oo->system->last_seen)
|| ($oo->system->hearbeat && ($oo->system->last_seen->addHours($oo->system->heartbeat) < Carbon::now()))
|| ((! $oo->system->hearbeat) && ($oo->role_id < Address::NODE_NN) && ($oo->system->last_seen->addHours(6) < Carbon::now())))
{
Log::info(sprintf('%s:- Polling [%s] (%s) - we havent seen them since [%s], heartbeat [%d]',
self::LOGKEY,
$oo->ftn,
$oo->system->name,
$oo->system->last_session ?: 'Never',
$oo->system->last_seen ?: 'Never',
$oo->system->heartbeat,
));
@@ -78,7 +78,7 @@ class SystemHeartbeat #implements ShouldQueue
Log::debug(sprintf('%s:= Not scheduling poll to [%s], we saw them [%s], heartbeat [%d]',
self::LOGKEY,
$oo->ftn,
$oo->system->last_session,
$oo->system->last_seen,
$oo->system->heartbeat
));
}