From: Aaron Schulz Date: Sat, 9 Mar 2019 01:36:21 +0000 (-0800) Subject: Make HTMLCacheUpdateJob avoid waiting on replication for no reason X-Git-Tag: 1.34.0-rc.0~2584 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/categories/supprimer.php?a=commitdiff_plain;h=7dc2f3993272d55f1b43d1ce6fd7a3be50bf39d2;p=lhc%2Fweb%2Fwiklou.git Make HTMLCacheUpdateJob avoid waiting on replication for no reason Change-Id: Ica381dad0bdb0555add1c7925e0e48991e7e0964 --- diff --git a/includes/jobqueue/jobs/HTMLCacheUpdateJob.php b/includes/jobqueue/jobs/HTMLCacheUpdateJob.php index 7d0ada5e97..73fa947790 100644 --- a/includes/jobqueue/jobs/HTMLCacheUpdateJob.php +++ b/includes/jobqueue/jobs/HTMLCacheUpdateJob.php @@ -135,9 +135,8 @@ class HTMLCacheUpdateJob extends Job { $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, @@ -146,6 +145,9 @@ class HTMLCacheUpdateJob extends Job { ], __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(