chore: Refactor GetContainersStatus.php for improved readability and maintainability

This commit is contained in:
Andras Bacsai 2024-05-08 09:23:32 +02:00
parent f6f959a897
commit 3eb4aed867

View File

@ -52,11 +52,13 @@ public function handle()
return;
}
$sentinel_found = instant_remote_process(["docker inspect coolify-sentinel"], $this->server, false);
if ($sentinel_found) {
raY('Sentinel');
$sentinel_found = json_decode($sentinel_found, true);
$status = data_get($sentinel_found, '0.State.Status', 'exited');
if ($status === 'running') {
ray('Sentinel');
$this->sentinel();
} else {
raY('Old way');
ray('Old way');
$this->old_way();
}
}
@ -107,7 +109,6 @@ private function sentinel()
if ($application) {
$foundApplications[] = $application->id;
$statusFromDb = $application->status;
ray($statusFromDb, $containerStatus);
if ($statusFromDb !== $containerStatus) {
$application->update(['status' => $containerStatus]);
}