mirror of
https://github.com/moodle/moodle.git
synced 2025-03-14 12:40:01 +01:00
MDL-67596 cron: Allow runners to ramp up instantly
This commit is contained in:
parent
c55402486b
commit
286cc88c8c
@ -96,7 +96,10 @@ function cron_run_scheduled_tasks(int $timenow) {
|
||||
|
||||
$scheduledlock = null;
|
||||
for ($run = 0; $run < $maxruns; $run++) {
|
||||
if ($scheduledlock = $cronlockfactory->get_lock("scheduled_task_runner_{$run}", 1)) {
|
||||
// If we can't get a lock instantly it means runner N is already running
|
||||
// so fail as fast as possible and try N+1 so we don't limit the speed at
|
||||
// which we bring new runners into the pool.
|
||||
if ($scheduledlock = $cronlockfactory->get_lock("scheduled_task_runner_{$run}", 0)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -140,7 +143,10 @@ function cron_run_adhoc_tasks(int $timenow, $keepalive = 0, $checklimits = true)
|
||||
if ($checklimits) {
|
||||
$adhoclock = null;
|
||||
for ($run = 0; $run < $maxruns; $run++) {
|
||||
if ($adhoclock = $cronlockfactory->get_lock("adhoc_task_runner_{$run}", 1)) {
|
||||
// If we can't get a lock instantly it means runner N is already running
|
||||
// so fail as fast as possible and try N+1 so we don't limit the speed at
|
||||
// which we bring new runners into the pool.
|
||||
if ($adhoclock = $cronlockfactory->get_lock("adhoc_task_runner_{$run}", 0)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user