Skip to content

Commit

Permalink
Refactor scheduling of container status and log drain checks
Browse files Browse the repository at this point in the history
  • Loading branch information
andrasbacsai committed May 16, 2024
1 parent b106a82 commit 2b74ca2
Showing 1 changed file with 3 additions and 19 deletions.
22 changes: 3 additions & 19 deletions app/Console/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
use App\Models\Team;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
use Illuminate\Support\Sleep;

class Kernel extends ConsoleKernel
{
Expand Down Expand Up @@ -77,28 +76,13 @@ private function check_resources($schedule)
$containerServers = $servers->where('settings.is_swarm_worker', false)->where('settings.is_build_server', false);
}
foreach ($containerServers as $server) {
$schedule->job(new ContainerStatusJob($server))->everyTwoMinutes()->onOneServer()->before(function () {
if (isCloud()) {
$wait = rand(5, 20);
Sleep::for($wait)->seconds();
}
});
$schedule->job(new ContainerStatusJob($server))->everyMinute()->onOneServer();
if ($server->isLogDrainEnabled()) {
$schedule->job(new CheckLogDrainContainerJob($server))->everyTwoMinutes()->onOneServer()->before(function () {
if (isCloud()) {
$wait = rand(5, 20);
Sleep::for($wait)->seconds();
}
});
$schedule->job(new CheckLogDrainContainerJob($server))->everyMinute()->onOneServer();
}
}
foreach ($servers as $server) {
$schedule->job(new ServerStatusJob($server))->everyTwoMinutes()->onOneServer()->before(function () {
if (isCloud()) {
$wait = rand(5, 20);
Sleep::for($wait)->seconds();
}
});
$schedule->job(new ServerStatusJob($server))->everyMinute()->onOneServer();
}
}
private function instance_auto_update($schedule)
Expand Down

0 comments on commit 2b74ca2

Please sign in to comment.