From 3a2d17bc055e0cb5654d46f93bcd74fa5d8b1bd4 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Thu, 28 Sep 2023 11:33:16 +0200 Subject: [PATCH] fix: containerStatusJob --- app/Console/Kernel.php | 2 -- app/Http/Livewire/Server/Proxy/Status.php | 6 ++---- app/Jobs/ContainerStatusJob.php | 3 ++- app/Notifications/Internal/GeneralNotification.php | 2 +- 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index 368f76f8f..0531899fe 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -40,8 +40,6 @@ class Kernel extends ConsoleKernel private function check_resources($schedule) { $servers = Server::all()->where('settings.is_usable', true)->where('settings.is_reachable', true); - ray($servers); - foreach ($servers as $server) { $schedule->job(new ContainerStatusJob($server))->everyMinute()->onOneServer(); } diff --git a/app/Http/Livewire/Server/Proxy/Status.php b/app/Http/Livewire/Server/Proxy/Status.php index 9a88e23f2..6eb198a4d 100644 --- a/app/Http/Livewire/Server/Proxy/Status.php +++ b/app/Http/Livewire/Server/Proxy/Status.php @@ -18,10 +18,8 @@ class Status extends Component public function getProxyStatus() { try { - if ($this->server->isFunctional()) { - dispatch_sync(new ContainerStatusJob($this->server)); - $this->emit('proxyStatusUpdated'); - } + dispatch_sync(new ContainerStatusJob($this->server)); + $this->emit('proxyStatusUpdated'); } catch (\Throwable $e) { return handleError($e, $this); } diff --git a/app/Jobs/ContainerStatusJob.php b/app/Jobs/ContainerStatusJob.php index 6fe26498e..6d27555f1 100644 --- a/app/Jobs/ContainerStatusJob.php +++ b/app/Jobs/ContainerStatusJob.php @@ -28,11 +28,12 @@ class ContainerStatusJob implements ShouldQueue, ShouldBeEncrypted public function __construct(public Server $server) { + $this->handle(); } public function middleware(): array { - return [new WithoutOverlapping($this->server->uuid)]; + return [(new WithoutOverlapping($this->server->uuid))->dontRelease()]; } public function uniqueId(): string diff --git a/app/Notifications/Internal/GeneralNotification.php b/app/Notifications/Internal/GeneralNotification.php index d00432ca9..ddb5a553d 100644 --- a/app/Notifications/Internal/GeneralNotification.php +++ b/app/Notifications/Internal/GeneralNotification.php @@ -12,7 +12,7 @@ class GeneralNotification extends Notification implements ShouldQueue { use Queueable; - public $tries = 5; + public $tries = 1; public function __construct(public string $message) { }