rdbms: add replica server counting methods to ILoadBalancer
[lhc/web/wiklou.git] / includes / jobqueue / JobRunner.php
index 1e83167..454f694 100644 (file)
@@ -131,7 +131,7 @@ class JobRunner implements LoggerAwareInterface {
                }
                // Bail out if there is too much DB lag.
                // This check should not block as we want to try other wiki queues.
-               list( , $maxLag ) = $lbFactory->getMainLB( wfWikiID() )->getMaxLag();
+               list( , $maxLag ) = $lbFactory->getMainLB()->getMaxLag();
                if ( $maxLag >= self::MAX_ALLOWED_LAG ) {
                        $response['reached'] = 'replica-lag-limit';
                        return $response;
@@ -290,8 +290,6 @@ class JobRunner implements LoggerAwareInterface {
                        $status = $job->run();
                        $error = $job->getLastError();
                        $this->commitMasterChanges( $lbFactory, $job, $fnameTrxOwner );
-                       // Important: this must be the last deferred update added (T100085, T154425)
-                       DeferredUpdates::addCallableUpdate( [ JobQueueGroup::class, 'pushLazyJobs' ] );
                        // Run any deferred update tasks; doUpdates() manages transactions itself
                        DeferredUpdates::doUpdates();
                } catch ( Exception $e ) {
@@ -536,8 +534,8 @@ class JobRunner implements LoggerAwareInterface {
                $syncThreshold = $this->config->get( 'JobSerialCommitThreshold' );
 
                $time = false;
-               $lb = $lbFactory->getMainLB( wfWikiID() );
-               if ( $syncThreshold !== false && $lb->getServerCount() > 1 ) {
+               $lb = $lbFactory->getMainLB();
+               if ( $syncThreshold !== false && $lb->hasStreamingReplicaServers() ) {
                        // Generally, there is one master connection to the local DB
                        $dbwSerial = $lb->getAnyOpenConnection( $lb->getWriterIndex() );
                        // We need natively blocking fast locks