From 2de481de6dd94bd5103c34d880e1f0c92256e7ac Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Fri, 8 Mar 2019 17:33:16 -0800 Subject: [PATCH] Make PurgeJobUtils::invalidatePages avoid waiting on replication for no reason Change-Id: I9ea4e4034ffc30a14b138279515447f990807e07 --- includes/jobqueue/utils/PurgeJobUtils.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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 ); + } } } ) ); -- 2.20.1