aboutsummaryrefslogtreecommitdiffstats
path: root/includes/objectcache
diff options
context:
space:
mode:
authorcsteipp <csteipp@wikimedia.org>2013-05-10 11:19:31 -0700
committercsteipp <csteipp@wikimedia.org>2013-05-10 12:42:16 -0700
commitd02b5bd7f762014d379b096a6ba87a2375f74372 (patch)
treec078f0fc9b1c08ca1f2b592b99267efb11fa0179 /includes/objectcache
parentdfaf583d83d513631c7006659be0ab252a8c7c7d (diff)
downloadmediawikicore-d02b5bd7f762014d379b096a6ba87a2375f74372.tar.gz
mediawikicore-d02b5bd7f762014d379b096a6ba87a2375f74372.zip
Add value to add() call when locking
When BagOStuff::lock() was called, it called $this->add() with only two parameters, the key and the timeout. But BagOStuff::add() takes three parameters (key, value, timeout), so all locks got an infinite timeout. Change-Id: I82bed11b0b799f2cda13a8a0bd0cd94908b6ce8e
Diffstat (limited to 'includes/objectcache')
-rw-r--r--includes/objectcache/BagOStuff.php4
1 files changed, 2 insertions, 2 deletions
diff --git a/includes/objectcache/BagOStuff.php b/includes/objectcache/BagOStuff.php
index 58ddd6a001e3..857943ee9018 100644
--- a/includes/objectcache/BagOStuff.php
+++ b/includes/objectcache/BagOStuff.php
@@ -170,7 +170,7 @@ abstract class BagOStuff {
*/
public function lock( $key, $timeout = 60 ) {
$timestamp = microtime( true ); // starting UNIX timestamp
- if ( $this->add( "{$key}:lock", $timeout ) ) {
+ if ( $this->add( "{$key}:lock", 1, $timeout ) ) {
return true;
}
@@ -186,7 +186,7 @@ abstract class BagOStuff {
$sleep *= 2;
}
usleep( $sleep ); // back off
- $locked = $this->add( "{$key}:lock", $timeout );
+ $locked = $this->add( "{$key}:lock", 1, $timeout );
} while ( !$locked );
return $locked;