From d02b5bd7f762014d379b096a6ba87a2375f74372 Mon Sep 17 00:00:00 2001 From: csteipp Date: Fri, 10 May 2013 11:19:31 -0700 Subject: [PATCH] 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 --- includes/objectcache/BagOStuff.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/objectcache/BagOStuff.php b/includes/objectcache/BagOStuff.php index 58ddd6a001..857943ee90 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; -- 2.20.1