X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FLoadBalancer.php;h=4ebe26c708a3e76ab3163f85ba2774b03ce380d6;hb=e115a47d4c46a8214db907480dab8d0aee72a9ef;hp=ac63bc47d547c047176b804a64e2deb7815dc469;hpb=b144fcb85da4316289421284d156e3eecf94e3da;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/LoadBalancer.php b/includes/LoadBalancer.php index ac63bc47d5..4ebe26c708 100644 --- a/includes/LoadBalancer.php +++ b/includes/LoadBalancer.php @@ -1,7 +1,6 @@ mWriteIndex = -1; $this->mForce = -1; $this->mConnections = array(); - $this->mLastIndex = 1; + $this->mLastIndex = -1; $this->mLoads = array(); $this->mWaitForFile = false; $this->mWaitForPos = false; @@ -97,7 +95,9 @@ class LoadBalancer { # Unset excessively lagged servers $lags = $this->getLagTimes(); foreach ( $lags as $i => $lag ) { - if ( isset( $this->mServers[$i]['max lag'] ) && $lag > $this->mServers[$i]['max lag'] ) { + if ( $i != 0 && isset( $this->mServers[$i]['max lag'] ) && + ( $lag === false || $lag > $this->mServers[$i]['max lag'] ) ) + { unset( $loads[$i] ); } } @@ -504,8 +504,7 @@ class LoadBalancer { * Save master pos to the session and to memcached, if the session exists */ function saveMasterPos() { - global $wgSessionStarted; - if ( $wgSessionStarted && count( $this->mServers ) > 1 ) { + if ( session_id() != '' && count( $this->mServers ) > 1 ) { # If this entire request was served from a slave without opening a connection to the # master (however unlikely that may be), then we can fetch the position from the slave. if ( empty( $this->mConnections[0] ) ) {