diff options
Diffstat (limited to 'includes/objectcache/BagOStuff.php')
-rw-r--r-- | includes/objectcache/BagOStuff.php | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/includes/objectcache/BagOStuff.php b/includes/objectcache/BagOStuff.php index dd744672..857943ee 100644 --- a/includes/objectcache/BagOStuff.php +++ b/includes/objectcache/BagOStuff.php @@ -170,12 +170,12 @@ 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; } $uRTT = ceil( 1e6 * ( microtime( true ) - $timestamp ) ); // estimate RTT (us) - $sleep = 2*$uRTT; // rough time to do get()+set() + $sleep = 2 * $uRTT; // rough time to do get()+set() $locked = false; // lock acquired $attempts = 0; // failed attempts @@ -186,8 +186,8 @@ abstract class BagOStuff { $sleep *= 2; } usleep( $sleep ); // back off - $locked = $this->add( "{$key}:lock", $timeout ); - } while( !$locked ); + $locked = $this->add( "{$key}:lock", 1, $timeout ); + } while ( !$locked ); return $locked; } |