/** @var LBFactory */
private static $instance;
+ /**
+ * Construct a factory based on a configuration array (typically from $wgLBFactoryConf)
+ * @param array $conf
+ */
+ public function __construct( array $conf ) {
+ }
+
/**
* Disables all access to the load balancer, will cause all database access
* to throw a DBAccessError
self::$instance = $instance;
}
- /**
- * Construct a factory based on a configuration array (typically from $wgLBFactoryConf)
- * @param array $conf
- */
- abstract public function __construct( array $conf );
-
/**
* Create a new load balancer object. The resulting object will be untracked,
* not chronology-protected, and the caller is responsible for cleaning it up.
* @throws MWException
*/
public function __construct( array $conf ) {
+ parent::__construct( $conf );
+
$this->chronProt = new ChronologyProtector;
$this->conf = $conf;
$required = array( 'sectionsByDB', 'sectionLoads', 'serverTemplate' );
private $loadMonitorClass;
public function __construct( array $conf ) {
+ parent::__construct( $conf );
+
$this->chronProt = new ChronologyProtector;
$this->loadMonitorClass = isset( $conf['loadMonitorClass'] )
? $conf['loadMonitorClass']
/** @var integer Warn when this many connection are held */
const CONN_HELD_WARN_THRESHOLD = 10;
+ /** @var integer Default 'max lag' when unspecified */
+ const MAX_LAG = 30;
/**
* @param array $params Array with keys:
* @param float $maxLag Restrict the maximum allowed lag to this many seconds
* @return bool|int|string
*/
- private function getRandomNonLagged( array $loads, $wiki = false, $maxLag = INF ) {
+ private function getRandomNonLagged( array $loads, $wiki = false, $maxLag = self::MAX_LAG ) {
$lags = $this->getLagTimes( $wiki );
# Unset excessively lagged servers