From: Aaron Schulz Date: Sat, 9 Mar 2019 01:33:16 +0000 (-0800) Subject: Make PurgeJobUtils::invalidatePages avoid waiting on replication for no reason X-Git-Tag: 1.34.0-rc.0~2583^2 X-Git-Url: http://git.cyclocoop.org/data/%24self?a=commitdiff_plain;h=2de481de6dd94bd5103c34d880e1f0c92256e7ac;p=lhc%2Fweb%2Fwiklou.git Make PurgeJobUtils::invalidatePages avoid waiting on replication for no reason Change-Id: I9ea4e4034ffc30a14b138279515447f990807e07 --- diff --git a/includes/jobqueue/utils/PurgeJobUtils.php b/includes/jobqueue/utils/PurgeJobUtils.php index ef364b54fe..1e40eb4efa 100644 --- a/includes/jobqueue/utils/PurgeJobUtils.php +++ b/includes/jobqueue/utils/PurgeJobUtils.php @@ -65,7 +65,8 @@ class PurgeJobUtils { $batchSize = $services->getMainConfig()->get( 'UpdateRowsPerQuery' ); $ticket = $lbFactory->getEmptyTransactionTicket( $fname ); - foreach ( array_chunk( $ids, $batchSize ) as $idBatch ) { + $idBatches = array_chunk( $ids, $batchSize ); + foreach ( $idBatches as $idBatch ) { $dbw->update( 'page', [ 'page_touched' => $now ], @@ -75,7 +76,9 @@ class PurgeJobUtils { ], $fname ); - $lbFactory->commitAndWaitForReplication( $fname, $ticket ); + if ( count( $idBatches ) > 1 ) { + $lbFactory->commitAndWaitForReplication( $fname, $ticket ); + } } } ) );