public function getMainLB( $wiki = false ) {
if ( !isset( $this->mainLB ) ) {
$this->mainLB = $this->newMainLB( $wiki );
- $this->mainLB->parentInfo( [ 'id' => 'main' ] );
$this->chronProt->initLB( $this->mainLB );
}
protected function newExternalLB( $cluster, $wiki = false ) {
global $wgExternalServers;
if ( !isset( $wgExternalServers[$cluster] ) ) {
- throw new MWException( __METHOD__ . ": Unknown cluster \"$cluster\"" );
+ throw new InvalidArgumentException( __METHOD__ . ": Unknown cluster \"$cluster\"" );
}
return $this->newLoadBalancer( $wgExternalServers[$cluster] );
public function getExternalLB( $cluster, $wiki = false ) {
if ( !isset( $this->extLBs[$cluster] ) ) {
$this->extLBs[$cluster] = $this->newExternalLB( $cluster, $wiki );
- $this->extLBs[$cluster]->parentInfo( [ 'id' => "ext-$cluster" ] );
$this->chronProt->initLB( $this->extLBs[$cluster] );
}
}
private function newLoadBalancer( array $servers ) {
- $lb = new LoadBalancer( [
- 'servers' => $servers,
- 'loadMonitor' => $this->loadMonitorClass,
- 'readOnlyReason' => $this->readOnlyReason,
- 'trxProfiler' => $this->trxProfiler,
- 'srvCache' => $this->srvCache,
- 'wanCache' => $this->wanCache
- ] );
-
+ $lb = new LoadBalancer( array_merge(
+ $this->baseLoadBalancerParams(),
+ [
+ 'servers' => $servers,
+ 'loadMonitor' => $this->loadMonitorClass,
+ ]
+ ) );
$this->initLoadBalancer( $lb );
return $lb;