Merge "Support non-replicating DB clusters for static datasets"
[lhc/web/wiklou.git] / includes / db / loadbalancer / LoadBalancer.php
index 5578099..d96c665 100644 (file)
@@ -1334,7 +1334,7 @@ class LoadBalancer {
 
                $lagTimes = $this->getLagTimes( $wiki );
                foreach ( $lagTimes as $i => $lag ) {
-                       if ( $lag > $maxLag ) {
+                       if ( $this->mLoads[$i] > 0 && $lag > $maxLag ) {
                                $maxLag = $lag;
                                $host = $this->mServers[$i]['host'];
                                $maxIndex = $i;
@@ -1402,7 +1402,7 @@ class LoadBalancer {
                }
 
                $pos = $pos ?: $this->getConnection( DB_MASTER )->getMasterPos();
-               if ( !$pos ) {
+               if ( !( $pos instanceof DBMasterPos ) ) {
                        return false; // something is misconfigured
                }