From 0c2a9d4f97b4b9e6eb86cb8710b0b8a291cfbb45 Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Wed, 20 Nov 2013 11:27:05 +0100 Subject: [PATCH] Remove function calls from for loop test part Change-Id: If1f8996854889b526fef96cd29a153e0b36e9133 --- includes/db/LoadBalancer.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/includes/db/LoadBalancer.php b/includes/db/LoadBalancer.php index 011c0831cc..bfa1adda1d 100644 --- a/includes/db/LoadBalancer.php +++ b/includes/db/LoadBalancer.php @@ -372,7 +372,8 @@ class LoadBalancer { public function waitForAll( $pos ) { wfProfileIn( __METHOD__ ); $this->mWaitForPos = $pos; - for ( $i = 1; $i < count( $this->mServers ); $i++ ) { + $serverCount = count( $this->mServers ); + for ( $i = 1; $i < $serverCount; $i++ ) { if ( $this->mLoads[$i] > 0 ) { $this->doWait( $i, true ); } @@ -850,7 +851,8 @@ class LoadBalancer { # master (however unlikely that may be), then we can fetch the position from the slave. $masterConn = $this->getAnyOpenConnection( 0 ); if ( !$masterConn ) { - for ( $i = 1; $i < count( $this->mServers ); $i++ ) { + $serverCount = count( $this->mServers ); + for ( $i = 1; $i < $serverCount; $i++ ) { $conn = $this->getAnyOpenConnection( $i ); if ( $conn ) { wfDebug( "Master pos fetched from slave\n" ); -- 2.20.1