$ticket = $factory->getEmptyTransactionTicket( __METHOD__ );
// Update page_touched (skipping pages already touched since the root job).
// Check $wgUpdateRowsPerQuery for sanity; batch jobs are sized by that already.
- foreach ( array_chunk( $pageIds, $wgUpdateRowsPerQuery ) as $batch ) {
- $factory->commitAndWaitForReplication( __METHOD__, $ticket );
-
+ $batches = array_chunk( $pageIds, $wgUpdateRowsPerQuery );
+ foreach ( $batches as $batch ) {
$dbw->update( 'page',
[ 'page_touched' => $dbw->timestamp( $touchTimestamp ) ],
[ 'page_id' => $batch,
],
__METHOD__
);
+ if ( count( $batches ) > 1 ) {
+ $factory->commitAndWaitForReplication( __METHOD__, $ticket );
+ }
}
// Get the list of affected pages (races only mean something else did the purge)
$titleArray = TitleArray::newFromResult( $dbw->select(