/** @var string */
private $loadMonitorClass;
+ /** @var int */
+ private $maxLag;
+
+ /** @var int Default 'maxLag' when unspecified */
+ const MAX_LAG_DEFAULT = 10;
/**
* @see LBFactory::__construct()
public function __construct( array $conf ) {
parent::__construct( $conf );
- $this->servers = isset( $conf['servers'] ) ? $conf['servers'] : [];
+ $this->servers = $conf['servers'] ?? [];
foreach ( $this->servers as $i => $server ) {
if ( $i == 0 ) {
$this->servers[$i]['master'] = true;
}
}
- $this->externalClusters = isset( $conf['externalClusters'] )
- ? $conf['externalClusters']
- : [];
- $this->loadMonitorClass = isset( $conf['loadMonitorClass'] )
- ? $conf['loadMonitorClass']
- : 'LoadMonitor';
+ $this->externalClusters = $conf['externalClusters'] ?? [];
+ $this->loadMonitorClass = $conf['loadMonitorClass'] ?? 'LoadMonitor';
+ $this->maxLag = $conf['maxLag'] ?? self::MAX_LAG_DEFAULT;
}
/**
$this->baseLoadBalancerParams(),
[
'servers' => $servers,
+ 'maxLag' => $this->maxLag,
'loadMonitor' => [ 'class' => $this->loadMonitorClass ],
]
) );