From: Aaron Schulz Date: Thu, 22 Oct 2015 03:14:54 +0000 (-0700) Subject: Bound BagOStuff::lock() RTT estimate for sanity X-Git-Tag: 1.31.0-rc.0~9287^2 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22suivi_revisions%22%29%20.%20%22?a=commitdiff_plain;h=fb7022c54d0da4773e437139c0cdb595fe83027d;p=lhc%2Fweb%2Fwiklou.git Bound BagOStuff::lock() RTT estimate for sanity The timestamp difference might be 0 (or in rare cases, less) Change-Id: I0298b413df637d9da5ff33c078ad49dadc8a46ce --- diff --git a/includes/libs/objectcache/BagOStuff.php b/includes/libs/objectcache/BagOStuff.php index 5dfec6ef72..c3c357ffa5 100644 --- a/includes/libs/objectcache/BagOStuff.php +++ b/includes/libs/objectcache/BagOStuff.php @@ -328,7 +328,8 @@ abstract class BagOStuff implements LoggerAwareInterface { } elseif ( $this->getLastError() || $timeout <= 0 ) { $locked = false; // network partition or non-blocking } else { - $uRTT = ceil( 1e6 * ( microtime( true ) - $timestamp ) ); // estimate RTT (us) + // Estimate the RTT (us); use 1ms minimum for sanity + $uRTT = max( 1e3, ceil( 1e6 * ( microtime( true ) - $timestamp ) ) ); $sleep = 2 * $uRTT; // rough time to do get()+set() $attempts = 0; // failed attempts