remove comments and remove duplicated scheduling

This commit is contained in:
ayntk-ai
2024-08-05 20:57:27 +02:00
parent b64d4881cb
commit 50ede5cab9
2 changed files with 2 additions and 7 deletions

View File

@@ -45,10 +45,6 @@ class Kernel extends ConsoleKernel
$schedule->command('cleanup:unreachable-servers')->daily(); $schedule->command('cleanup:unreachable-servers')->daily();
$schedule->job(new PullTemplatesFromCDN)->daily()->onOneServer(); $schedule->job(new PullTemplatesFromCDN)->daily()->onOneServer();
$schedule->job(new CleanupInstanceStuffsJob)->everyFiveMinutes()->onOneServer(); $schedule->job(new CleanupInstanceStuffsJob)->everyFiveMinutes()->onOneServer();
$schedule->job(new PullCoolifyImageJob)->cron($settings->update_check_frequency ?? '0 0 * * *')->onOneServer();
$schedule->job(new CheckForUpdatesJob())->cron($settings->auto_update_frequency ?? '0 11,23 * * *')->onOneServer();
// Server Jobs
$this->scheduleUpdates($schedule); $this->scheduleUpdates($schedule);
$this->pull_images($schedule); $this->pull_images($schedule);
$this->check_resources($schedule); $this->check_resources($schedule);
@@ -76,11 +72,11 @@ class Kernel extends ConsoleKernel
{ {
$settings = InstanceSettings::get(); $settings = InstanceSettings::get();
$updateCheckFrequency = $settings->update_check_frequency ?? '0 0 * * *'; // Default to daily at 00:00 $updateCheckFrequency = $settings->update_check_frequency ?? '0 0 * * *';
$schedule->job(new CheckForUpdatesJob())->cron($updateCheckFrequency)->onOneServer(); $schedule->job(new CheckForUpdatesJob())->cron($updateCheckFrequency)->onOneServer();
if ($settings->is_auto_update_enabled) { if ($settings->is_auto_update_enabled) {
$autoUpdateFrequency = $settings->auto_update_frequency ?? '0 11,23 * * *'; // Default to twice daily at 11:00 and 23:00 $autoUpdateFrequency = $settings->auto_update_frequency ?? '0 11,23 * * *';
$schedule->job(new UpdateCoolifyJob())->cron($autoUpdateFrequency)->onOneServer(); $schedule->job(new UpdateCoolifyJob())->cron($autoUpdateFrequency)->onOneServer();
} }
} }

View File

@@ -91,7 +91,6 @@ class Configuration extends Component
} }
$this->validate(); $this->validate();
// Allow empty values and set defaults
if ($this->is_auto_update_enabled && !$this->validateCronExpression($this->auto_update_frequency)) { if ($this->is_auto_update_enabled && !$this->validateCronExpression($this->auto_update_frequency)) {
$this->dispatch('error', 'Invalid Cron / Human expression for Auto Update Frequency.'); $this->dispatch('error', 'Invalid Cron / Human expression for Auto Update Frequency.');
return; return;