MDL-80385 core: Check lock state before attempting to acquire a lock

This is a cherry-pick of the same change from MDL-76865, which was
accidentally reverted in MDL-79428.
This commit is contained in:
Dale Davies
2024-03-13 13:56:44 +00:00
committed by Paul Holden
parent 0ff19ca287
commit f1dc10573f
+2 -1
View File
@@ -621,7 +621,8 @@ class cache implements cache_loader {
// store; parent method will have set it to all stores if needed.
if ($setaftervalidation) {
$lock = null;
if (!empty($this->requirelockingbeforewrite)) {
// Only try to acquire a lock for this cache if we do not already have one.
if (!empty($this->requirelockingbeforewrite) && !$this->check_lock_state($key)) {
$lock = $this->acquire_lock($key);
}
if ($requiredversion === self::VERSION_NONE) {