refactor: Remove unnecessary debug statements and improve code structure in RunRemoteProcess.php and ApplicationDeploymentJob.php
This commit is contained in:
parent
ee5c694aa2
commit
07e801f44d
@ -5,7 +5,6 @@ namespace App\Actions\CoolifyTask;
|
|||||||
use App\Enums\ActivityTypes;
|
use App\Enums\ActivityTypes;
|
||||||
use App\Enums\ProcessStatus;
|
use App\Enums\ProcessStatus;
|
||||||
use App\Jobs\ApplicationDeploymentJob;
|
use App\Jobs\ApplicationDeploymentJob;
|
||||||
use App\Jobs\ApplicationDeploymentJobNew;
|
|
||||||
use App\Models\Server;
|
use App\Models\Server;
|
||||||
use Illuminate\Process\ProcessResult;
|
use Illuminate\Process\ProcessResult;
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
@ -166,23 +165,13 @@ class RunRemoteProcess
|
|||||||
public function encodeOutput($type, $output)
|
public function encodeOutput($type, $output)
|
||||||
{
|
{
|
||||||
$outputStack = json_decode($this->activity->description, associative: true, flags: JSON_THROW_ON_ERROR | JSON_UNESCAPED_UNICODE);
|
$outputStack = json_decode($this->activity->description, associative: true, flags: JSON_THROW_ON_ERROR | JSON_UNESCAPED_UNICODE);
|
||||||
if (isDev()) {
|
$outputStack[] = [
|
||||||
$outputStack[] = [
|
'type' => $type,
|
||||||
'type' => $type,
|
'output' => $output,
|
||||||
'output' => $output,
|
'timestamp' => hrtime(true),
|
||||||
'timestamp' => hrtime(true),
|
'batch' => ApplicationDeploymentJob::$batch_counter,
|
||||||
'batch' => ApplicationDeploymentJobNew::$batch_counter,
|
'order' => $this->getLatestCounter(),
|
||||||
'order' => $this->getLatestCounter(),
|
];
|
||||||
];
|
|
||||||
} else {
|
|
||||||
$outputStack[] = [
|
|
||||||
'type' => $type,
|
|
||||||
'output' => $output,
|
|
||||||
'timestamp' => hrtime(true),
|
|
||||||
'batch' => ApplicationDeploymentJob::$batch_counter,
|
|
||||||
'order' => $this->getLatestCounter(),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
return json_encode($outputStack, flags: JSON_THROW_ON_ERROR | JSON_UNESCAPED_UNICODE);
|
return json_encode($outputStack, flags: JSON_THROW_ON_ERROR | JSON_UNESCAPED_UNICODE);
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
use App\Enums\ApplicationDeploymentStatus;
|
use App\Enums\ApplicationDeploymentStatus;
|
||||||
use App\Jobs\ApplicationDeploymentJob;
|
use App\Jobs\ApplicationDeploymentJob;
|
||||||
use App\Jobs\ApplicationDeploymentJobNew;
|
|
||||||
use App\Models\Application;
|
use App\Models\Application;
|
||||||
use App\Models\ApplicationDeploymentQueue;
|
use App\Models\ApplicationDeploymentQueue;
|
||||||
use App\Models\Server;
|
use App\Models\Server;
|
||||||
@ -43,26 +42,14 @@ function queue_application_deployment(Application $application, string $deployme
|
|||||||
'only_this_server' => $only_this_server
|
'only_this_server' => $only_this_server
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if (isDev()) {
|
if ($no_questions_asked) {
|
||||||
if ($no_questions_asked) {
|
dispatch(new ApplicationDeploymentJob(
|
||||||
dispatch(new ApplicationDeploymentJobNew(
|
application_deployment_queue_id: $deployment->id,
|
||||||
application_deployment_queue_id: $deployment->id,
|
));
|
||||||
));
|
} else if (next_queuable($server_id, $application_id)) {
|
||||||
} else if (next_queuable($server_id, $application_id)) {
|
dispatch(new ApplicationDeploymentJob(
|
||||||
dispatch(new ApplicationDeploymentJobNew(
|
application_deployment_queue_id: $deployment->id,
|
||||||
application_deployment_queue_id: $deployment->id,
|
));
|
||||||
));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if ($no_questions_asked) {
|
|
||||||
dispatch(new ApplicationDeploymentJob(
|
|
||||||
application_deployment_queue_id: $deployment->id,
|
|
||||||
));
|
|
||||||
} else if (next_queuable($server_id, $application_id)) {
|
|
||||||
dispatch(new ApplicationDeploymentJob(
|
|
||||||
application_deployment_queue_id: $deployment->id,
|
|
||||||
));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function force_start_deployment(ApplicationDeploymentQueue $deployment)
|
function force_start_deployment(ApplicationDeploymentQueue $deployment)
|
||||||
@ -70,15 +57,10 @@ function force_start_deployment(ApplicationDeploymentQueue $deployment)
|
|||||||
$deployment->update([
|
$deployment->update([
|
||||||
'status' => ApplicationDeploymentStatus::IN_PROGRESS->value,
|
'status' => ApplicationDeploymentStatus::IN_PROGRESS->value,
|
||||||
]);
|
]);
|
||||||
if (isDev()) {
|
|
||||||
dispatch(new ApplicationDeploymentJobNew(
|
dispatch(new ApplicationDeploymentJob(
|
||||||
application_deployment_queue_id: $deployment->id,
|
application_deployment_queue_id: $deployment->id,
|
||||||
));
|
));
|
||||||
} else {
|
|
||||||
dispatch(new ApplicationDeploymentJob(
|
|
||||||
application_deployment_queue_id: $deployment->id,
|
|
||||||
));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
function queue_next_deployment(Application $application)
|
function queue_next_deployment(Application $application)
|
||||||
{
|
{
|
||||||
@ -88,15 +70,10 @@ function queue_next_deployment(Application $application)
|
|||||||
$next_found->update([
|
$next_found->update([
|
||||||
'status' => ApplicationDeploymentStatus::IN_PROGRESS->value,
|
'status' => ApplicationDeploymentStatus::IN_PROGRESS->value,
|
||||||
]);
|
]);
|
||||||
if (isDev()) {
|
|
||||||
dispatch(new ApplicationDeploymentJobNew(
|
dispatch(new ApplicationDeploymentJob(
|
||||||
application_deployment_queue_id: $next_found->id,
|
application_deployment_queue_id: $next_found->id,
|
||||||
));
|
));
|
||||||
} else {
|
|
||||||
dispatch(new ApplicationDeploymentJob(
|
|
||||||
application_deployment_queue_id: $next_found->id,
|
|
||||||
));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user