Merge branch 'MDL-78092-master' of https://github.com/sammarshallou/moodle

This commit is contained in:
Jun Pataleta
2023-06-01 11:36:44 +08:00
3 changed files with 105 additions and 3 deletions

View File

@@ -640,7 +640,10 @@ class course_modinfo {
$cachecoursemodinfo = cache::make('core', 'coursemodinfo');
$cachekey = $course->id;
$cachecoursemodinfo->acquire_lock($cachekey);
if (!$cachecoursemodinfo->acquire_lock($cachekey)) {
throw new moodle_exception('ex_unabletolock', 'cache', '', null,
'Unable to lock modinfo cache for course ' . $cachekey);
}
try {
// Only actually do the build if it's still needed after getting the lock (not if
// somebody else, who might have been holding the lock, built it already).