fix(docker): add protection against empty container queries in GetContainersStatus to prevent unnecessary updates
This commit is contained in:
@@ -274,24 +274,13 @@ class GetContainersStatus
|
|||||||
if (str($application->status)->startsWith('exited')) {
|
if (str($application->status)->startsWith('exited')) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$application->update(['status' => 'exited']);
|
|
||||||
|
|
||||||
$name = data_get($application, 'name');
|
// Only protection: If no containers at all, Docker query might have failed
|
||||||
$fqdn = data_get($application, 'fqdn');
|
if ($this->containers->isEmpty()) {
|
||||||
|
continue;
|
||||||
$containerName = $name ? "$name ($fqdn)" : $fqdn;
|
|
||||||
|
|
||||||
$projectUuid = data_get($application, 'environment.project.uuid');
|
|
||||||
$applicationUuid = data_get($application, 'uuid');
|
|
||||||
$environment = data_get($application, 'environment.name');
|
|
||||||
|
|
||||||
if ($projectUuid && $applicationUuid && $environment) {
|
|
||||||
$url = base_url().'/project/'.$projectUuid.'/'.$environment.'/application/'.$applicationUuid;
|
|
||||||
} else {
|
|
||||||
$url = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// $this->server->team?->notify(new ContainerStopped($containerName, $this->server, $url));
|
$application->update(['status' => 'exited']);
|
||||||
}
|
}
|
||||||
$notRunningApplicationPreviews = $previews->pluck('id')->diff($foundApplicationPreviews);
|
$notRunningApplicationPreviews = $previews->pluck('id')->diff($foundApplicationPreviews);
|
||||||
foreach ($notRunningApplicationPreviews as $previewId) {
|
foreach ($notRunningApplicationPreviews as $previewId) {
|
||||||
@@ -299,24 +288,13 @@ class GetContainersStatus
|
|||||||
if (str($preview->status)->startsWith('exited')) {
|
if (str($preview->status)->startsWith('exited')) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$preview->update(['status' => 'exited']);
|
|
||||||
|
|
||||||
$name = data_get($preview, 'name');
|
// Only protection: If no containers at all, Docker query might have failed
|
||||||
$fqdn = data_get($preview, 'fqdn');
|
if ($this->containers->isEmpty()) {
|
||||||
|
continue;
|
||||||
$containerName = $name ? "$name ($fqdn)" : $fqdn;
|
|
||||||
|
|
||||||
$projectUuid = data_get($preview, 'application.environment.project.uuid');
|
|
||||||
$environmentName = data_get($preview, 'application.environment.name');
|
|
||||||
$applicationUuid = data_get($preview, 'application.uuid');
|
|
||||||
|
|
||||||
if ($projectUuid && $applicationUuid && $environmentName) {
|
|
||||||
$url = base_url().'/project/'.$projectUuid.'/'.$environmentName.'/application/'.$applicationUuid;
|
|
||||||
} else {
|
|
||||||
$url = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// $this->server->team?->notify(new ContainerStopped($containerName, $this->server, $url));
|
$preview->update(['status' => 'exited']);
|
||||||
}
|
}
|
||||||
$notRunningDatabases = $databases->pluck('id')->diff($foundDatabases);
|
$notRunningDatabases = $databases->pluck('id')->diff($foundDatabases);
|
||||||
foreach ($notRunningDatabases as $database) {
|
foreach ($notRunningDatabases as $database) {
|
||||||
|
|||||||
Reference in New Issue
Block a user