revert delayed jobs

This commit is contained in:
Andras Bacsai 2024-03-05 08:49:11 +01:00
parent 9ad6631747
commit f3a279be26

View File

@ -72,36 +72,43 @@ 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))->everyMinute()->onOneServer();
$schedule
->call(function () use ($server) {
$randomSeconds = rand(1, 40);
$job = new ContainerStatusJob($server);
$job->delay($randomSeconds);
ray('dispatching container status job in ' . $randomSeconds . ' seconds');
dispatch($job);
})->name('container-status-' . $server->id)->everyMinute()->onOneServer();
$schedule->job(new ContainerStatusJob($server))->everyMinute()->onOneServer();
if ($server->isLogDrainEnabled()) {
// $schedule->job(new CheckLogDrainContainerJob($server))->everyMinute()->onOneServer();
$schedule
->call(function () use ($server) {
$randomSeconds = rand(1, 40);
$job = new CheckLogDrainContainerJob($server);
$job->delay($randomSeconds);
dispatch($job);
})->name('log-drain-container-check-' . $server->id)->everyMinute()->onOneServer();
$schedule->job(new CheckLogDrainContainerJob($server))->everyMinute()->onOneServer();
}
}
foreach ($servers as $server) {
// $schedule->job(new ServerStatusJob($server))->everyMinute()->onOneServer();
$schedule
->call(function () use ($server) {
$randomSeconds = rand(1, 40);
$job = new ServerStatusJob($server);
$job->delay($randomSeconds);
dispatch($job);
})->name('server-status-job-' . $server->id)->everyMinute()->onOneServer();
$schedule->job(new ServerStatusJob($server))->everyMinute()->onOneServer();
}
// Delayed Jobs
// foreach ($containerServers as $server) {
// $schedule
// ->call(function () use ($server) {
// $randomSeconds = rand(1, 40);
// $job = new ContainerStatusJob($server);
// $job->delay($randomSeconds);
// ray('dispatching container status job in ' . $randomSeconds . ' seconds');
// dispatch($job);
// })->name('container-status-' . $server->id)->everyMinute()->onOneServer();
// if ($server->isLogDrainEnabled()) {
// $schedule
// ->call(function () use ($server) {
// $randomSeconds = rand(1, 40);
// $job = new CheckLogDrainContainerJob($server);
// $job->delay($randomSeconds);
// dispatch($job);
// })->name('log-drain-container-check-' . $server->id)->everyMinute()->onOneServer();
// }
// }
// foreach ($servers as $server) {
// $schedule
// ->call(function () use ($server) {
// $randomSeconds = rand(1, 40);
// $job = new ServerStatusJob($server);
// $job->delay($randomSeconds);
// dispatch($job);
// })->name('server-status-job-' . $server->id)->everyMinute()->onOneServer();
// }
}
private function instance_auto_update($schedule)
{