From: Tim Starling Date: Sat, 25 Jun 2005 13:48:02 +0000 (+0000) Subject: fixed repeated balancing bug X-Git-Tag: 1.5.0beta1~27 X-Git-Url: http://git.cyclocoop.org/%28%5B%5E//%22%22?a=commitdiff_plain;h=5c21483236a59ed0f397cddae9f59f0d1b719239;p=lhc%2Fweb%2Fwiklou.git fixed repeated balancing bug --- diff --git a/includes/LoadBalancer.php b/includes/LoadBalancer.php index a60d28476b..ee402d68e5 100644 --- a/includes/LoadBalancer.php +++ b/includes/LoadBalancer.php @@ -145,7 +145,13 @@ class LoadBalancer { return $this->pickRandom( $loads ); } - + /** + * Get the index of the reader connection, which may be a slave + * This takes into account load ratios and lag times. It should + * always return a consistent index during a given invocation + * + * Side effect: opens connections to databases + */ function getReaderIndex() { global $wgMaxLag, $wgReadOnly, $wgDBClusterTimeout; @@ -215,7 +221,7 @@ class LoadBalancer { $this->mServers[$i]['slave pos'] = $this->mConnections[$i]->getSlavePos(); } } - if ( $i != false ) { + if ( $i !== false ) { $this->mReadIndex = $i; } } else {