From b52680a2d8e1ec56e71c0ea5186021b1a61af722 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Thu, 30 Nov 2023 12:55:31 +0100 Subject: [PATCH] Fix dispatch_sync issue in ContainerStatusJob --- app/Http/Livewire/Project/Service/Index.php | 2 +- app/Jobs/ContainerStatusJob.php | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/app/Http/Livewire/Project/Service/Index.php b/app/Http/Livewire/Project/Service/Index.php index 79d933369..af88fac87 100644 --- a/app/Http/Livewire/Project/Service/Index.php +++ b/app/Http/Livewire/Project/Service/Index.php @@ -28,7 +28,7 @@ class Index extends Component } public function checkStatus() { - dispatch_sync(new ContainerStatusJob($this->service->server)); + dispatch(new ContainerStatusJob($this->service->server)); $this->refreshStacks(); } public function refreshStacks() diff --git a/app/Jobs/ContainerStatusJob.php b/app/Jobs/ContainerStatusJob.php index 1f20bb264..baabc966c 100644 --- a/app/Jobs/ContainerStatusJob.php +++ b/app/Jobs/ContainerStatusJob.php @@ -21,10 +21,6 @@ class ContainerStatusJob implements ShouldQueue, ShouldBeEncrypted { use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; - public function __construct(public Server $server) - { - $this->handle(); - } public function middleware(): array { return [(new WithoutOverlapping($this->server->id))->dontRelease()]; @@ -35,6 +31,11 @@ class ContainerStatusJob implements ShouldQueue, ShouldBeEncrypted return $this->server->id; } + public function __construct(public Server $server) + { + } + + public function handle() { // ray("checking container statuses for {$this->server->id}");