From a1e0d9058f134cd8312c6f2ba201a094a6278dc0 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Fri, 6 May 2016 18:49:44 -0700 Subject: [PATCH] Make recent changes update jobs use configurable $wgUpdateRowsPerQuery Change-Id: I05d64ccefda79f46cd792c57f9617a13e5d84973 --- includes/jobqueue/jobs/RecentChangesUpdateJob.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/includes/jobqueue/jobs/RecentChangesUpdateJob.php b/includes/jobqueue/jobs/RecentChangesUpdateJob.php index 22afead165..fbc1572512 100644 --- a/includes/jobqueue/jobs/RecentChangesUpdateJob.php +++ b/includes/jobqueue/jobs/RecentChangesUpdateJob.php @@ -70,7 +70,7 @@ class RecentChangesUpdateJob extends Job { } protected function purgeExpiredRows() { - global $wgRCMaxAge; + global $wgRCMaxAge, $wgUpdateRowsPerQuery; $lockKey = wfWikiID() . ':recentchanges-prune'; @@ -81,14 +81,13 @@ class RecentChangesUpdateJob extends Job { return; // already in progress } - $batchSize = 100; // avoid slave lag $cutoff = $dbw->timestamp( time() - $wgRCMaxAge ); do { $rcIds = $dbw->selectFieldValues( 'recentchanges', 'rc_id', [ 'rc_timestamp < ' . $dbw->addQuotes( $cutoff ) ], __METHOD__, - [ 'LIMIT' => $batchSize ] + [ 'LIMIT' => $wgUpdateRowsPerQuery ] ); if ( $rcIds ) { $dbw->delete( 'recentchanges', [ 'rc_id' => $rcIds ], __METHOD__ ); @@ -96,7 +95,7 @@ class RecentChangesUpdateJob extends Job { // Commit in chunks to avoid slave lag $dbw->commit( __METHOD__, 'flush' ); - if ( count( $rcIds ) === $batchSize ) { + if ( count( $rcIds ) === $wgUpdateRowsPerQuery ) { // There might be more, so try waiting for slaves try { wfGetLBFactory()->waitForReplication( [ 'timeout' => 3 ] ); -- 2.20.1