diff --git a/app/Jobs/AddressIdle.php b/app/Jobs/AddressIdle.php index 0eec182..e6bf6f1 100644 --- a/app/Jobs/AddressIdle.php +++ b/app/Jobs/AddressIdle.php @@ -51,8 +51,8 @@ class AddressIdle implements ShouldQueue // Delist DOWN nodes foreach ($this->old($this->do,config('fido.idle.delist'),Address::NODE_DOWN,$this->ao) as $ao) { // Only delist system that has been marked down - // Only mark delist them if its been 7 days since they were marked DOWN - if ((! $ao->is_down) || ($ao->updated_at->isPast(Carbon::now()->subWeek()))) + // Only mark delist them if its been 14 days since they were marked DOWN + if ((! $ao->is_down) || ($ao->updated_at->greaterThan(Carbon::now()->subWeeks(2)))) continue; Log::info(sprintf('%s:- Delisting [%s], not seen for [%d] days',self::LOGKEY,$ao->ftn,config('fido.idle.delist'))); @@ -130,8 +130,9 @@ class AddressIdle implements ShouldQueue $result->push($ao); } + // @todo Make sure we only process addresses that we are responsible for, eg: 1/999 shouldnt have been processed even though 3/999 as eligible (and they are were connected to the same system) // Mark nodes as HOLD - foreach ($this->old($this->do,config('fido.idle.hold'),0,$this->ao) as $ao) { + foreach ($this->old($this->do,config('fido.idle.hold'),Address::NODE_ALL,$this->ao) as $ao) { // Ignore any systems that are a Discoverd System if ($ao->system->name === System::default) { Log::alert(sprintf('%s:! Ignoring HOLD for discovered System [%s]',self::LOGKEY,$ao->ftn)); diff --git a/app/Models/Address.php b/app/Models/Address.php index 9e20570..70c402c 100644 --- a/app/Models/Address.php +++ b/app/Models/Address.php @@ -228,7 +228,7 @@ class Address extends Model }) ->orWhere('host_id',$ftn['n']); }) - ->with(['system:id,active,name,address,pkt_msgs']) + ->with(['system:id,active,name,address,pkt_msgs,last_session']) ->first(); // Check and see if we are a flattened domain, our address might be available with a different zone. diff --git a/app/Notifications/Echomails/AbsentNodes.php b/app/Notifications/Echomails/AbsentNodes.php index 0955774..d7a0fdb 100644 --- a/app/Notifications/Echomails/AbsentNodes.php +++ b/app/Notifications/Echomails/AbsentNodes.php @@ -58,7 +58,7 @@ class AbsentNodes extends Echomails $msg->addText("The following nodes have had their status changed, because they are absent from the network.\r\r"); // Nodes marked HOLD - will be marked down ... - if (($x=$this->aos->filter(fn($item)=>$item->role & Address::NODE_HOLD))->count()) { + if (($x=$this->aos->filter(fn($item)=>$item->active && ($item->role & Address::NODE_HOLD)))->count()) { $msg->addText("The following nodes have been marked HOLD:\r"); foreach ($x as $ao) @@ -68,7 +68,7 @@ class AbsentNodes extends Echomails } // Nodes marked DOWN - will be delisted on... - if (($x=$this->aos->filter(fn($item)=>$item->role & Address::NODE_DOWN))->count()) { + if (($x=$this->aos->filter(fn($item)=>$item->active && ($item->role & Address::NODE_DOWN)))->count()) { $msg->addText("The following nodes have been marked DOWN:\r"); foreach ($x as $ao) diff --git a/app/Notifications/Netmails/NodeDelisted.php b/app/Notifications/Netmails/NodeDelisted.php index 3cbdc92..d4b51ed 100644 --- a/app/Notifications/Netmails/NodeDelisted.php +++ b/app/Notifications/Netmails/NodeDelisted.php @@ -35,9 +35,9 @@ class NodeDelisted extends Netmails //implements ShouldQueue $o = $this->setupNetmail($notifiable); $ao = $notifiable->routeNotificationFor(static::via); - Log::info(sprintf('%s:+ Sending a NODE MARKED HOLD for address [%s]',self::LOGKEY,$ao->ftn)); + Log::info(sprintf('%s:+ Sending a NODE DE-LISTED for address [%s]',self::LOGKEY,$ao->ftn)); - $o->subject = sprintf('Your system has been DE-LISTED from %s',$x=$ao->zone->domain->name); + $o->subject = sprintf('Your system has been DE-LISTED from %s',$x=$this->ao->zone->domain->name); $o->flags = (Message::FLAG_LOCAL|Message::FLAG_PRIVATE|Message::FLAG_CRASH); // Message @@ -46,7 +46,7 @@ class NodeDelisted extends Netmails //implements ShouldQueue $msg->addText(sprintf("Hi %s,\r\r",$this->ao->system->sysop)) ->addText(sprintf("Your system has been marked **DE-LISTED**, because it hasnt polled **%s** with address %s since **%s** (%d days).\r",$this->ao->zone->domain->name,$this->ao->ftn4d,$this->ao->system->last_session->format('Y-m-d'),$this->ao->system->last_session->diffInDays($now))) ->addText("\r") - ->addText("If you think this was a mistake, please let me know.\r") + ->addText("If you think this was a mistake, please let me know.\r\r") ->addText(sprintf('If you think about returning to %s, then reach out and we can get you back online pretty quickly.',$x)); $o->msg = $msg->render(); diff --git a/resources/views/status.blade.php b/resources/views/status.blade.php index 8483e74..1a1b41f 100644 --- a/resources/views/status.blade.php +++ b/resources/views/status.blade.php @@ -180,6 +180,9 @@ @if (($x=$o->uplink()) && ($x->id !== $o->id))
[via {{ $x->ftn4d }}] @endif + @if($o->is_down || $o->is_hold) +
@if($o->is_down)DOWN @elseif($o->is_hold)HOLD @else? @endif
+ @endif {{ $o->ftn4d }} {{ number_format($o->uncollected_echomail ?? 0) }}