Refactor server filtering logic in Kernel.php

This commit is contained in:
Andras Bacsai 2023-11-17 13:11:46 +01:00
parent 2c4e69ad50
commit 8c73068cc7
2 changed files with 4 additions and 4 deletions

View File

@ -43,7 +43,7 @@ protected function schedule(Schedule $schedule): void
}
private function pull_helper_image($schedule)
{
$servers = Server::all()->where('settings.is_usable', true)->where('settings.is_reachable', true);
$servers = Server::all()->where('settings.is_usable', true)->where('settings.is_reachable', true)->where('ip', '!=', '1.2.3.4');
foreach ($servers as $server) {
$schedule->job(new PullHelperImageJob($server))->everyTenMinutes()->onOneServer();
}
@ -51,9 +51,9 @@ private function pull_helper_image($schedule)
private function check_resources($schedule)
{
if (isCloud()) {
$servers = Server::all()->whereNotNull('team.subscription')->where('team.subscription.stripe_trial_already_ended', false);
$servers = Server::all()->whereNotNull('team.subscription')->where('team.subscription.stripe_trial_already_ended', false)->where('ip', '!=', '1.2.3.4');
} else {
$servers = Server::all();
$servers = Server::all()->where('ip', '!=', '1.2.3.4');
}
foreach ($servers as $server) {
$schedule->job(new ServerStatusJob($server))->everyTenMinutes()->onOneServer();

View File

@ -168,7 +168,7 @@ public function checkServerRediness()
$db->update(['status' => 'exited']);
}
}
throw new \Exception('Server is not reachable.');
return false;
}
$result = $this->validateConnection();
ray('validateConnection: ' . $result);