From: Aaron Schulz Date: Sun, 3 Feb 2019 02:13:17 +0000 (-0800) Subject: objectcache: avoid duplicate set() calls with lockTSE when no value is in cache X-Git-Tag: 1.34.0-rc.0~2952^2 X-Git-Url: http://git.cyclocoop.org/%28?a=commitdiff_plain;h=70bf85d4626;p=lhc%2Fweb%2Fwiklou.git objectcache: avoid duplicate set() calls with lockTSE when no value is in cache Each thread will still run the callback, but only one will save the value back Bug: T203786 Change-Id: Idc4738aa005cc44ec0f1adc6dcf2e3f87d0c9480 --- diff --git a/includes/libs/objectcache/WANObjectCache.php b/includes/libs/objectcache/WANObjectCache.php index 6e8d266e14..88f87f857e 100644 --- a/includes/libs/objectcache/WANObjectCache.php +++ b/includes/libs/objectcache/WANObjectCache.php @@ -1334,7 +1334,8 @@ class WANObjectCache implements IExpiringStore, LoggerAwareInterface { $this->setInterimValue( $key, $wrapped, $tempTTL ); } - if ( $valueIsCacheable ) { + // Save the value unless a mutex-winning thread is already expected to do that + if ( $valueIsCacheable && ( !$useMutex || $lockAcquired ) ) { $setOpts['lockTSE'] = $lockTSE; $setOpts['staleTTL'] = $staleTTL; // Use best known "since" timestamp if not provided