return $this->pickRandom( $loads );
}
-
+ /**
+ * Get the index of the reader connection, which may be a slave
+ * This takes into account load ratios and lag times. It should
+ * always return a consistent index during a given invocation
+ *
+ * Side effect: opens connections to databases
+ */
function getReaderIndex()
{
global $wgMaxLag, $wgReadOnly, $wgDBClusterTimeout;
$this->mServers[$i]['slave pos'] = $this->mConnections[$i]->getSlavePos();
}
}
- if ( $i != false ) {
+ if ( $i !== false ) {
$this->mReadIndex = $i;
}
} else {