moved the status call so it is only called if max_lag is set, since that is the only...
authorJason Richey <jasonr@users.mediawiki.org>
Wed, 29 Nov 2006 23:13:59 +0000 (23:13 +0000)
committerJason Richey <jasonr@users.mediawiki.org>
Wed, 29 Nov 2006 23:13:59 +0000 (23:13 +0000)
includes/LoadBalancer.php

index 3690b43..396ef86 100644 (file)
@@ -174,10 +174,9 @@ class LoadBalancer {
                                                        unset( $loads[$i] );
                                                        $sleepTime = 0;
                                                } else {
-                                                       $status = $this->mConnections[$i]->getStatus("Thread%");
-                                                       if ( isset( $this->mServers[$i]['max threads'] ) &&
-                                                         $status['Threads_running'] > $this->mServers[$i]['max threads'] )
-                                                       {
+                                                       if ( isset( $this->mServers[$i]['max threads'] ) ) {
+                                                           $status = $this->mConnections[$i]->getStatus("Thread%");
+                                                           if ( $status['Threads_running'] > $this->mServers[$i]['max threads'] ) {
                                                                # Too much load, back off and wait for a while.
                                                                # The sleep time is scaled by the number of threads connected,
                                                                # to produce a roughly constant global poll rate.
@@ -185,9 +184,13 @@ class LoadBalancer {
 
                                                                # If we reach the timeout and exit the loop, don't use it
                                                                $i = false;
-                                                       } else {
+                                                           } else {
                                                                $done = true;
                                                                $sleepTime = 0;
+                                                           }
+                                                       } else {
+                                                           $done = true;
+                                                           $sleepTime = 0;
                                                        }
                                                }
                                        } else {