* don't record readerindex if already recorded, or not in global loads
if ( count( $this->mServers ) == 1 ) {
# Skip the load balancing if there's only one server
return 0;
- } elseif ( $this->mReadIndex >= 0 ) {
+ } elseif ( $group === false and $this->mReadIndex >= 0 ) {
+ # Shortcut if generic reader exists already
return $this->mReadIndex;
}
$this->mServers[$i]['slave pos'] = $conn->getSlavePos();
}
}
- if ( $i !== false ) {
+ if ( $this->mReadIndex <=0 && $this->mLoads[$i]>0 && $i !== false ) {
$this->mReadIndex = $i;
}
}