Refactor container status and log drain checks scheduling

This commit is contained in:
Andras Bacsai 2024-05-16 10:08:00 +02:00
parent 27c4fa2fcf
commit 6826b6e1f8

View File

@ -78,22 +78,28 @@ private function check_resources($schedule)
}
foreach ($containerServers as $server) {
$schedule->job(new ContainerStatusJob($server))->everyTwoMinutes()->onOneServer()->before(function () {
$wait = rand(5, 20);
ray('waiting for ' . $wait . ' seconds');
Sleep::for($wait)->seconds();
ray('waited for ' . $wait . ' seconds');
if (isCloud()) {
$wait = rand(5, 20);
ray('waiting for ' . $wait . ' seconds');
Sleep::for($wait)->seconds();
ray('waited for ' . $wait . ' seconds');
}
});
if ($server->isLogDrainEnabled()) {
$schedule->job(new CheckLogDrainContainerJob($server))->everyTwoMinutes()->onOneServer()->before(function () {
$wait = rand(5, 20);
Sleep::for($wait)->seconds();
if (isCloud()) {
$wait = rand(5, 20);
Sleep::for($wait)->seconds();
}
});
}
}
foreach ($servers as $server) {
$schedule->job(new ServerStatusJob($server))->everyTwoMinutes()->onOneServer()->before(function () {
$wait = rand(5, 20);
Sleep::for($wait)->seconds();
if (isCloud()) {
$wait = rand(5, 20);
Sleep::for($wait)->seconds();
}
});
}
}