Update app/Jobs/DeleteResourceJob.php

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
This commit is contained in:
Andras Bacsai 2025-11-11 11:35:30 +01:00 committed by GitHub
parent ae6ad5175a
commit e79316c8b5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -125,15 +125,15 @@ private function deleteApplicationPreview()
} }
// Cancel any active deployments for this PR (same logic as API cancel_deployment) // Cancel any active deployments for this PR (same logic as API cancel_deployment)
$activeDeployment = \App\Models\ApplicationDeploymentQueue::where('application_id', $application->id) $activeDeployments = \App\Models\ApplicationDeploymentQueue::where('application_id', $application->id)
->where('pull_request_id', $pull_request_id) ->where('pull_request_id', $pull_request_id)
->whereIn('status', [ ->whereIn('status', [
\App\Enums\ApplicationDeploymentStatus::QUEUED->value, \App\Enums\ApplicationDeploymentStatus::QUEUED->value,
\App\Enums\ApplicationDeploymentStatus::IN_PROGRESS->value, \App\Enums\ApplicationDeploymentStatus::IN_PROGRESS->value,
]) ])
->first(); ->get();
if ($activeDeployment) { foreach ($activeDeployments as $activeDeployment) {
try { try {
// Mark deployment as cancelled // Mark deployment as cancelled
$activeDeployment->update([ $activeDeployment->update([