+ $load_cooldown = DI::config()->get('system', 'worker_load_cooldown');
+ $processes_cooldown = DI::config()->get('system', 'worker_processes_cooldown');
+
+ while ((($load_cooldown > 0) || ($processes_cooldown > 0)) && ($load = System::getLoadAvg())) {
+ if (($load_cooldown > 0) && ($load['average1'] > $load_cooldown)) {
+ Logger::debug('Load induced pre execution cooldown.', ['max' => $load_cooldown, 'load' => $load, 'id' => $queue['id'], 'priority' => $queue['priority'], 'command' => $queue['command']]);
+ sleep(1);
+ continue;
+ }
+ if (($processes_cooldown > 0) && ($load['scheduled'] > $processes_cooldown)) {
+ Logger::debug('Process induced pre execution cooldown.', ['max' => $processes_cooldown, 'load' => $load, 'id' => $queue['id'], 'priority' => $queue['priority'], 'command' => $queue['command']]);
+ sleep(1);
+ continue;
+ }
+ break;
+ }
+