}
protected function purgeExpiredRows() {
- global $wgRCMaxAge;
+ global $wgRCMaxAge, $wgUpdateRowsPerQuery;
$lockKey = wfWikiID() . ':recentchanges-prune';
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__ );
// 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 ] );