From 2a842a2f50f100e784bd0c7844ccf0e13305b28a Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Fri, 1 Sep 2023 16:30:50 +0200 Subject: [PATCH] Do not schedule autoupdate --- app/Console/Kernel.php | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index 07032e1a1..7e0bbf580 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -9,6 +9,7 @@ use App\Jobs\InstanceAutoUpdateJob; use App\Jobs\ProxyCheckJob; use App\Jobs\ResourceStatusJob; +use App\Models\InstanceSettings; use App\Models\ScheduledDatabaseBackup; use Illuminate\Console\Scheduling\Schedule; use Illuminate\Foundation\Console\Kernel as ConsoleKernel; @@ -17,28 +18,33 @@ class Kernel extends ConsoleKernel { protected function schedule(Schedule $schedule): void { - // $schedule->call(fn() => $this->check_scheduled_backups($schedule))->everyTenSeconds(); if (isDev()) { $schedule->command('horizon:snapshot')->everyMinute(); $schedule->job(new ResourceStatusJob)->everyMinute(); $schedule->job(new ProxyCheckJob)->everyFiveMinutes(); $schedule->job(new CleanupInstanceStuffsJob)->everyMinute(); - // $schedule->job(new CheckResaleLicenseJob)->hourly(); $schedule->job(new DockerCleanupJob)->everyOddHour(); - // $schedule->job(new InstanceAutoUpdateJob(true))->everyMinute(); } else { $schedule->command('horizon:snapshot')->everyFiveMinutes(); - $schedule->job(new CleanupInstanceStuffsJob)->everyMinute()->onOneServer(); + $schedule->job(new CleanupInstanceStuffsJob)->everyTenMinutes()->onOneServer(); $schedule->job(new ResourceStatusJob)->everyMinute()->onOneServer(); $schedule->job(new CheckResaleLicenseJob)->hourly()->onOneServer(); $schedule->job(new ProxyCheckJob)->everyFiveMinutes()->onOneServer(); $schedule->job(new DockerCleanupJob)->everyTenMinutes()->onOneServer(); - $schedule->job(new InstanceAutoUpdateJob)->everyTenMinutes(); } + $this->instance_auto_update($schedule); $this->check_scheduled_backups($schedule); } - + private function instance_auto_update($schedule){ + if (isDev()) { + return; + } + $settings = InstanceSettings::get(); + if ($settings->is_auto_update_enabled) { + $schedule->job(new InstanceAutoUpdateJob)->everyTenMinutes()->onOneServer(); + } + } private function check_scheduled_backups($schedule) { ray('check_scheduled_backups'); @@ -57,7 +63,7 @@ private function check_scheduled_backups($schedule) } $schedule->job(new DatabaseBackupJob( backup: $scheduled_backup - ))->cron($scheduled_backup->frequency); + ))->cron($scheduled_backup->frequency)->onOneServer(); } }