refactor(deployment): streamline next deployment queuing logic by repositioning queue_next_deployment call

This commit is contained in:
Andras Bacsai
2025-09-10 13:26:35 +02:00
parent f18dff186d
commit d10e4fa388
2 changed files with 2 additions and 4 deletions

View File

@@ -2457,8 +2457,6 @@ COPY ./nginx.conf /etc/nginx/conf.d/default.conf");
private function next(string $status) private function next(string $status)
{ {
queue_next_deployment($this->application);
// Never allow changing status from FAILED or CANCELLED_BY_USER to anything else // Never allow changing status from FAILED or CANCELLED_BY_USER to anything else
if ($this->application_deployment_queue->status === ApplicationDeploymentStatus::FAILED->value) { if ($this->application_deployment_queue->status === ApplicationDeploymentStatus::FAILED->value) {
$this->application->environment->project->team?->notify(new DeploymentFailed($this->application, $this->deployment_uuid, $this->preview)); $this->application->environment->project->team?->notify(new DeploymentFailed($this->application, $this->deployment_uuid, $this->preview));
@@ -2473,6 +2471,8 @@ COPY ./nginx.conf /etc/nginx/conf.d/default.conf");
'status' => $status, 'status' => $status,
]); ]);
queue_next_deployment($this->application);
if ($status === ApplicationDeploymentStatus::FINISHED->value) { if ($status === ApplicationDeploymentStatus::FINISHED->value) {
if (! $this->only_this_server) { if (! $this->only_this_server) {
$this->deploy_to_additional_destinations(); $this->deploy_to_additional_destinations();

View File

@@ -108,7 +108,6 @@ function queue_next_deployment(Application $application)
ApplicationDeploymentJob::dispatch( ApplicationDeploymentJob::dispatch(
application_deployment_queue_id: $next_deployment->id, application_deployment_queue_id: $next_deployment->id,
); );
break;
} }
} }
} }
@@ -158,7 +157,6 @@ function next_after_cancel(?Server $server = null)
ApplicationDeploymentJob::dispatch( ApplicationDeploymentJob::dispatch(
application_deployment_queue_id: $next->id, application_deployment_queue_id: $next->id,
); );
break;
} }
} }
} }