+ public function scaleLoads( array &$weightByServer, $domain ) {
+ $serverIndexes = array_keys( $weightByServer );
+ $states = $this->getServerStates( $serverIndexes, $domain );
+ $coefficientsByServer = $states['weightScales'];
+ foreach ( $weightByServer as $i => $weight ) {
+ if ( isset( $coefficientsByServer[$i] ) ) {
+ $weightByServer[$i] = $weight * $coefficientsByServer[$i];
+ } else { // server recently added to config?
+ $host = $this->parent->getServerName( $i );
+ $this->replLogger->error( __METHOD__ . ": host $host not in cache" );
+ }
+ }
+ }
+
+ public function getLagTimes( array $serverIndexes, $domain ) {
+ $states = $this->getServerStates( $serverIndexes, $domain );
+
+ return $states['lagTimes'];