fix: update last online with old function

This commit is contained in:
Andras Bacsai
2024-11-08 09:43:46 +01:00
parent e69b0ca1a9
commit a2b6a61c4a
3 changed files with 11 additions and 2 deletions

View File

@@ -107,6 +107,8 @@ class GetContainersStatus
$statusFromDb = $preview->status; $statusFromDb = $preview->status;
if ($statusFromDb !== $containerStatus) { if ($statusFromDb !== $containerStatus) {
$preview->update(['status' => $containerStatus]); $preview->update(['status' => $containerStatus]);
} else {
$preview->update(['last_online_at' => now()]);
} }
} else { } else {
//Notify user that this container should not be there. //Notify user that this container should not be there.
@@ -118,6 +120,8 @@ class GetContainersStatus
$statusFromDb = $application->status; $statusFromDb = $application->status;
if ($statusFromDb !== $containerStatus) { if ($statusFromDb !== $containerStatus) {
$application->update(['status' => $containerStatus]); $application->update(['status' => $containerStatus]);
} else {
$application->update(['last_online_at' => now()]);
} }
} else { } else {
//Notify user that this container should not be there. //Notify user that this container should not be there.
@@ -160,7 +164,10 @@ class GetContainersStatus
$statusFromDb = $database->status; $statusFromDb = $database->status;
if ($statusFromDb !== $containerStatus) { if ($statusFromDb !== $containerStatus) {
$database->update(['status' => $containerStatus]); $database->update(['status' => $containerStatus]);
} else {
$database->update(['last_online_at' => now()]);
} }
if ($isPublic) { if ($isPublic) {
$foundTcpProxy = $this->containers->filter(function ($value, $key) use ($uuid) { $foundTcpProxy = $this->containers->filter(function ($value, $key) use ($uuid) {
if ($this->server->isSwarm()) { if ($this->server->isSwarm()) {
@@ -202,6 +209,8 @@ class GetContainersStatus
if ($statusFromDb !== $containerStatus) { if ($statusFromDb !== $containerStatus) {
// ray('Updating status: ' . $containerStatus); // ray('Updating status: ' . $containerStatus);
$service->update(['status' => $containerStatus]); $service->update(['status' => $containerStatus]);
} else {
$service->update(['last_online_at' => now()]);
} }
} }
} }

View File

@@ -14,7 +14,7 @@ use App\Models\Service;
use App\Models\ServiceApplication; use App\Models\ServiceApplication;
use App\Models\ServiceDatabase; use App\Models\ServiceDatabase;
use App\Notifications\Container\ContainerRestarted; use App\Notifications\Container\ContainerRestarted;
use Arr; use Illuminate\Support\Arr;
use Lorisleiva\Actions\Concerns\AsAction; use Lorisleiva\Actions\Concerns\AsAction;
class ServerCheck class ServerCheck

View File

@@ -1238,7 +1238,7 @@ $schema://$host {
StartSentinel::run($this, true); StartSentinel::run($this, true);
} }
} catch (\Throwable $e) { } catch (\Throwable $e) {
return handleError($e, $this); return handleError($e);
} }
} }