mirror of
https://github.com/tiennm99/coolify.git
synced 2026-10-19 02:14:05 +00:00
perf: Remove dead server filtering code from Kernel scheduler (#7585)
This commit is contained in:
2 files changed
+4
-21
No files matched your search
@@ -14,15 +14,11 @@ use App\Jobs\ScheduledJobManager;
|
|||||||
use App\Jobs\ServerManagerJob;
|
use App\Jobs\ServerManagerJob;
|
||||||
use App\Jobs\UpdateCoolifyJob;
|
use App\Jobs\UpdateCoolifyJob;
|
||||||
use App\Models\InstanceSettings;
|
use App\Models\InstanceSettings;
|
||||||
use App\Models\Server;
|
|
||||||
use App\Models\Team;
|
|
||||||
use Illuminate\Console\Scheduling\Schedule;
|
use Illuminate\Console\Scheduling\Schedule;
|
||||||
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
||||||
|
|
||||||
class Kernel extends ConsoleKernel
|
class Kernel extends ConsoleKernel
|
||||||
{
|
{
|
||||||
private $allServers;
|
|
||||||
|
|
||||||
private Schedule $scheduleInstance;
|
private Schedule $scheduleInstance;
|
||||||
|
|
||||||
private InstanceSettings $settings;
|
private InstanceSettings $settings;
|
||||||
@@ -34,8 +30,6 @@ class Kernel extends ConsoleKernel
|
|||||||
protected function schedule(Schedule $schedule): void
|
protected function schedule(Schedule $schedule): void
|
||||||
{
|
{
|
||||||
$this->scheduleInstance = $schedule;
|
$this->scheduleInstance = $schedule;
|
||||||
$this->allServers = Server::where('ip', '!=', '1.2.3.4');
|
|
||||||
|
|
||||||
$this->settings = instanceSettings();
|
$this->settings = instanceSettings();
|
||||||
$this->updateCheckFrequency = $this->settings->update_check_frequency ?: '0 * * * *';
|
$this->updateCheckFrequency = $this->settings->update_check_frequency ?: '0 * * * *';
|
||||||
|
|
||||||
@@ -95,14 +89,6 @@ class Kernel extends ConsoleKernel
|
|||||||
|
|
||||||
private function pullImages(): void
|
private function pullImages(): void
|
||||||
{
|
{
|
||||||
if (isCloud()) {
|
|
||||||
$servers = $this->allServers->whereRelation('team.subscription', 'stripe_invoice_paid', true)->whereRelation('settings', 'is_usable', true)->whereRelation('settings', 'is_reachable', true)->get();
|
|
||||||
$own = Team::find(0)->servers;
|
|
||||||
$servers = $servers->merge($own);
|
|
||||||
} else {
|
|
||||||
$servers = $this->allServers->whereRelation('settings', 'is_usable', true)->whereRelation('settings', 'is_reachable', true)->get();
|
|
||||||
}
|
|
||||||
// Sentinel update checks are now handled by ServerManagerJob
|
|
||||||
$this->scheduleInstance->job(new CheckHelperImageJob)
|
$this->scheduleInstance->job(new CheckHelperImageJob)
|
||||||
->cron($this->updateCheckFrequency)
|
->cron($this->updateCheckFrequency)
|
||||||
->timezone($this->instanceTimezone)
|
->timezone($this->instanceTimezone)
|
||||||
|
|||||||
@@ -160,13 +160,10 @@ class ServerManagerJob implements ShouldQueue
|
|||||||
ServerPatchCheckJob::dispatch($server);
|
ServerPatchCheckJob::dispatch($server);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for sentinel updates hourly (independent of user-configurable update_check_frequency)
|
// Sentinel update checks (hourly) - check for updates to Sentinel version
|
||||||
if ($server->isSentinelEnabled()) {
|
// No timezone needed for hourly - runs at top of every hour
|
||||||
$shouldCheckSentinel = $this->shouldRunNow('0 * * * *', $serverTimezone);
|
if ($isSentinelEnabled && $this->shouldRunNow('0 * * * *')) {
|
||||||
|
CheckAndStartSentinelJob::dispatch($server);
|
||||||
if ($shouldCheckSentinel) {
|
|
||||||
CheckAndStartSentinelJob::dispatch($server);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user