From dca332a6882db684ead60ee287286206f6795ee3 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Mon, 4 Sep 2023 16:59:02 +0200 Subject: [PATCH] fix: overlapping apps --- app/Jobs/ApplicationDeploymentJob.php | 6 ------ app/Jobs/DockerCleanupJob.php | 7 ++++++- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/app/Jobs/ApplicationDeploymentJob.php b/app/Jobs/ApplicationDeploymentJob.php index 579311c46..260bc6b88 100644 --- a/app/Jobs/ApplicationDeploymentJob.php +++ b/app/Jobs/ApplicationDeploymentJob.php @@ -67,12 +67,6 @@ class ApplicationDeploymentJob implements ShouldQueue private Collection $saved_outputs; public $tries = 1; - public function middleware(): array - { - return [ - (new WithoutOverlapping("dockerimagejobs"))->shared(), - ]; - } public function __construct(int $application_deployment_queue_id) { ray()->clearScreen(); diff --git a/app/Jobs/DockerCleanupJob.php b/app/Jobs/DockerCleanupJob.php index 4456eee5e..ecdf6dbcb 100644 --- a/app/Jobs/DockerCleanupJob.php +++ b/app/Jobs/DockerCleanupJob.php @@ -2,6 +2,7 @@ namespace App\Jobs; +use App\Models\ApplicationDeploymentQueue; use App\Models\Server; use Illuminate\Bus\Queueable; use Illuminate\Contracts\Queue\ShouldQueue; @@ -9,7 +10,6 @@ use Illuminate\Queue\InteractsWithQueue; use Illuminate\Queue\Middleware\WithoutOverlapping; use Illuminate\Queue\SerializesModels; -use Illuminate\Support\Str; class DockerCleanupJob implements ShouldQueue { @@ -30,6 +30,11 @@ public function __construct() } public function handle(): void { + $queue = ApplicationDeploymentQueue::where('status', '==', 'in_progress')->get(); + if ($queue->count() > 0) { + ray('DockerCleanupJob: ApplicationDeploymentQueue is not empty, skipping')->color('orange'); + return; + } try { ray()->showQueries()->color('orange'); $servers = Server::all();