fix: containerStatusJob

This commit is contained in:
Andras Bacsai 2023-09-28 11:33:16 +02:00
parent 4c1067cf36
commit 3a2d17bc05
4 changed files with 5 additions and 8 deletions

View File

@ -40,8 +40,6 @@ protected function schedule(Schedule $schedule): void
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();
}

View File

@ -18,10 +18,8 @@ public function proxyStatusUpdated()
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);
}

View File

@ -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

View File

@ -12,7 +12,7 @@ class GeneralNotification extends Notification implements ShouldQueue
{
use Queueable;
public $tries = 5;
public $tries = 1;
public function __construct(public string $message)
{
}