rdbms: tweak var names in LoadMonitor::scaleLoads()/getLagTimes()
authorAaron Schulz <aschulz@wikimedia.org>
Fri, 16 Feb 2018 21:50:08 +0000 (13:50 -0800)
committerAaron Schulz <aschulz@wikimedia.org>
Sun, 18 Feb 2018 20:52:50 +0000 (20:52 +0000)
Also mark the methods as "final" due to their delegation

Change-Id: Ie32f53445f749d9a00e77fce43d75830e260c039

includes/libs/rdbms/loadmonitor/LoadMonitor.php

index 74c7765..50c878d 100644 (file)
@@ -81,13 +81,13 @@ class LoadMonitor implements ILoadMonitor {
                $this->replLogger = $logger;
        }
 
                $this->replLogger = $logger;
        }
 
-       public function scaleLoads( array &$weightByServer, $domain ) {
+       final public function scaleLoads( array &$weightByServer, $domain ) {
                $serverIndexes = array_keys( $weightByServer );
                $states = $this->getServerStates( $serverIndexes, $domain );
                $serverIndexes = array_keys( $weightByServer );
                $states = $this->getServerStates( $serverIndexes, $domain );
-               $coefficientsByServer = $states['weightScales'];
+               $newScalesByServer = $states['weightScales'];
                foreach ( $weightByServer as $i => $weight ) {
                foreach ( $weightByServer as $i => $weight ) {
-                       if ( isset( $coefficientsByServer[$i] ) ) {
-                               $weightByServer[$i] = $weight * $coefficientsByServer[$i];
+                       if ( isset( $newScalesByServer[$i] ) ) {
+                               $weightByServer[$i] = $weight * $newScalesByServer[$i];
                        } else { // server recently added to config?
                                $host = $this->parent->getServerName( $i );
                                $this->replLogger->error( __METHOD__ . ": host $host not in cache" );
                        } else { // server recently added to config?
                                $host = $this->parent->getServerName( $i );
                                $this->replLogger->error( __METHOD__ . ": host $host not in cache" );
@@ -95,10 +95,8 @@ class LoadMonitor implements ILoadMonitor {
                }
        }
 
                }
        }
 
-       public function getLagTimes( array $serverIndexes, $domain ) {
-               $states = $this->getServerStates( $serverIndexes, $domain );
-
-               return $states['lagTimes'];
+       final public function getLagTimes( array $serverIndexes, $domain ) {
+               return $this->getServerStates( $serverIndexes, $domain )['lagTimes'];
        }
 
        protected function getServerStates( array $serverIndexes, $domain ) {
        }
 
        protected function getServerStates( array $serverIndexes, $domain ) {