Merge "Warn if stateful ParserOutput transforms are used"
[lhc/web/wiklou.git] / includes / libs / rdbms / lbfactory / LBFactorySimple.php
index 15cd508..9a6aa3a 100644 (file)
@@ -41,6 +41,11 @@ class LBFactorySimple extends LBFactory {
 
        /** @var string */
        private $loadMonitorClass;
+       /** @var int */
+       private $maxLag;
+
+       /** @var int Default 'maxLag' when unspecified */
+       const MAX_LAG_DEFAULT = 10;
 
        /**
         * @see LBFactory::__construct()
@@ -72,6 +77,7 @@ class LBFactorySimple extends LBFactory {
                $this->loadMonitorClass = isset( $conf['loadMonitorClass'] )
                        ? $conf['loadMonitorClass']
                        : 'LoadMonitor';
+               $this->maxLag = isset( $conf['maxLag'] ) ? $conf['maxLag'] : self::MAX_LAG_DEFAULT;
        }
 
        /**
@@ -89,7 +95,6 @@ class LBFactorySimple extends LBFactory {
        public function getMainLB( $domain = false ) {
                if ( !isset( $this->mainLB ) ) {
                        $this->mainLB = $this->newMainLB( $domain );
-                       $this->getChronologyProtector()->initLB( $this->mainLB );
                }
 
                return $this->mainLB;
@@ -106,7 +111,6 @@ class LBFactorySimple extends LBFactory {
        public function getExternalLB( $cluster ) {
                if ( !isset( $this->extLBs[$cluster] ) ) {
                        $this->extLBs[$cluster] = $this->newExternalLB( $cluster );
-                       $this->getChronologyProtector()->initLB( $this->extLBs[$cluster] );
                }
 
                return $this->extLBs[$cluster];
@@ -130,6 +134,7 @@ class LBFactorySimple extends LBFactory {
                        $this->baseLoadBalancerParams(),
                        [
                                'servers' => $servers,
+                               'maxLag' => $this->maxLag,
                                'loadMonitor' => [ 'class' => $this->loadMonitorClass ],
                        ]
                ) );