$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 ],
],
$fname
);
- $lbFactory->commitAndWaitForReplication( $fname, $ticket );
+ if ( count( $idBatches ) > 1 ) {
+ $lbFactory->commitAndWaitForReplication( $fname, $ticket );
+ }
}
}
) );