diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index 730cf4113..8bbab0081 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -19,13 +19,9 @@ class Kernel extends ConsoleKernel protected function schedule(Schedule $schedule): void { if (isDev()) { - // $schedule->job(new ContainerStatusJob(Server::find(0)))->everyTenMinutes()->onOneServer(); - // $schedule->command('horizon:snapshot')->everyMinute(); + $schedule->command('horizon:snapshot')->everyMinute(); $schedule->job(new CleanupInstanceStuffsJob)->everyMinute()->onOneServer(); - // $schedule->job(new CheckResaleLicenseJob)->hourly(); - // $schedule->job(new DockerCleanupJob)->everyOddHour(); - // $this->instance_auto_update($schedule); - // $this->check_scheduled_backups($schedule); + $this->check_scheduled_backups($schedule); $this->check_resources($schedule); $this->cleanup_servers($schedule); $this->check_scheduled_backups($schedule); @@ -69,7 +65,6 @@ class Kernel extends ConsoleKernel } private function check_scheduled_backups($schedule) { - ray('check_scheduled_backups'); $scheduled_backups = ScheduledDatabaseBackup::all(); if ($scheduled_backups->isEmpty()) { ray('no scheduled backups'); diff --git a/app/Jobs/ContainerStatusJob.php b/app/Jobs/ContainerStatusJob.php index 4e9f53990..24c869219 100644 --- a/app/Jobs/ContainerStatusJob.php +++ b/app/Jobs/ContainerStatusJob.php @@ -12,7 +12,6 @@ use App\Notifications\Server\Revived; use App\Notifications\Server\Unreachable; use Illuminate\Bus\Queueable; use Illuminate\Contracts\Queue\ShouldBeEncrypted; -use Illuminate\Contracts\Queue\ShouldBeUnique; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Foundation\Bus\Dispatchable; use Illuminate\Queue\InteractsWithQueue; @@ -25,28 +24,23 @@ class ContainerStatusJob implements ShouldQueue, ShouldBeEncrypted { use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; - public $tries = 1; - public $timeout = 120; - - public function middleware(): array - { - return [(new WithoutOverlapping($this->server->uuid))->dontRelease()]; - } - - public function uniqueId(): string - { - return $this->server->uuid; - } - public function __construct(public Server $server) { - $this->handle(); + } + public function middleware(): array + { + return [(new WithoutOverlapping($this->server->id))->dontRelease()]; } - public function handle() + public function uniqueId(): int { + return $this->server->id; + } + + public function handle(): void + { + ray("checking server status for {$this->server->id}"); try { - // ray("checking server status for {$this->server->id}"); // ray()->clearAll(); $serverUptimeCheckNumber = $this->server->unreachable_count; $serverUptimeCheckNumberMax = 3; @@ -305,7 +299,7 @@ class ContainerStatusJob implements ShouldQueue, ShouldBeEncrypted } catch (\Throwable $e) { send_internal_notification('ContainerStatusJob failed with: ' . $e->getMessage()); ray($e->getMessage()); - return handleError($e); + handleError($e); } } }