N°4692 - Enable parallelization of multiple CRON jobs

This commit is contained in:
Eric Espie
2026-08-19 15:58:21 +02:00
parent 1cdc2c5648
commit 263dc8cc9f
9 changed files with 443 additions and 260 deletions

View File

@@ -3249,4 +3249,24 @@ TXT
return (int)$sLimit;
}
}
/**
* Count the number of cron.php processes currently running
*
* @return int process count
* @throws \Exception
*/
public static function CountCronRunning(): int
{
$iMaxCronProcess = max(MetaModel::GetConfig()->Get('cron.max_processes'), 1);
$iCount = 0;
for ($i = 0; $i < $iMaxCronProcess; $i++) {
$oMutex = new iTopMutex("cron#$i");
if ($oMutex->IsLocked()) {
$iCount++;
}
}
return $iCount;
}
}