mirror of
https://github.com/moodle/moodle.git
synced 2025-01-31 12:45:04 +01:00
MDL-50719 cron: Fixed parallel task lock contention issues
This commit is contained in:
parent
0f59b6dd75
commit
504d569b71
@ -421,8 +421,16 @@ class manager {
|
||||
|
||||
foreach ($records as $record) {
|
||||
|
||||
if ($lock = $cronlockfactory->get_lock('adhoc_' . $record->id, 10)) {
|
||||
if ($lock = $cronlockfactory->get_lock('adhoc_' . $record->id, 0)) {
|
||||
$classname = '\\' . $record->classname;
|
||||
|
||||
// Safety check, see if the task has been already processed by another cron run.
|
||||
$record = $DB->get_record('task_adhoc', array('id' => $record->id));
|
||||
if (!$record) {
|
||||
$lock->release();
|
||||
continue;
|
||||
}
|
||||
|
||||
$task = self::adhoc_task_from_record($record);
|
||||
// Safety check in case the task in the DB does not match a real class (maybe something was uninstalled).
|
||||
if (!$task) {
|
||||
@ -472,7 +480,7 @@ class manager {
|
||||
|
||||
foreach ($records as $record) {
|
||||
|
||||
if ($lock = $cronlockfactory->get_lock(($record->classname), 10)) {
|
||||
if ($lock = $cronlockfactory->get_lock(($record->classname), 0)) {
|
||||
$classname = '\\' . $record->classname;
|
||||
$task = self::scheduled_task_from_record($record);
|
||||
// Safety check in case the task in the DB does not match a real class (maybe something was uninstalled).
|
||||
|
Loading…
x
Reference in New Issue
Block a user