fix: if usagebefore cannot be determined, cleanup docker with force
This commit is contained in:
@@ -26,17 +26,6 @@ class DockerCleanupJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
public function handle(): void
|
public function handle(): void
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
// $isInprogress = false;
|
|
||||||
// $this->server->applications()->each(function ($application) use (&$isInprogress) {
|
|
||||||
// if ($application->isDeploymentInprogress()) {
|
|
||||||
// $isInprogress = true;
|
|
||||||
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// if ($isInprogress) {
|
|
||||||
// throw new RuntimeException('DockerCleanupJob: ApplicationDeploymentQueue is not empty, skipping...');
|
|
||||||
// }
|
|
||||||
if (! $this->server->isFunctional()) {
|
if (! $this->server->isFunctional()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -48,6 +37,12 @@ class DockerCleanupJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->usageBefore = $this->server->getDiskUsage();
|
$this->usageBefore = $this->server->getDiskUsage();
|
||||||
|
if ($this->usageBefore === null) {
|
||||||
|
Log::info('DockerCleanupJob force cleanup on '.$this->server->name);
|
||||||
|
CleanupDocker::run(server: $this->server, force: true);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
if ($this->usageBefore >= $this->server->settings->cleanup_after_percentage) {
|
if ($this->usageBefore >= $this->server->settings->cleanup_after_percentage) {
|
||||||
CleanupDocker::run(server: $this->server, force: false);
|
CleanupDocker::run(server: $this->server, force: false);
|
||||||
$usageAfter = $this->server->getDiskUsage();
|
$usageAfter = $this->server->getDiskUsage();
|
||||||
|
Reference in New Issue
Block a user