Remove Block::purgeExpired() call from block query API

This avoids master queries on HTTP GET. Filter out rows on the
fly and allow for pruning to only happen when blocks do.

Change-Id: Idd25b2f8a789ba191fde87e997910e78d67c7021
This commit is contained in:
Aaron Schulz 2016-08-28 11:37:39 -07:00
parent b59365e675
commit 0bf5f49f14
2 changed files with 3 additions and 6 deletions

View file

@ -173,10 +173,8 @@ class ApiQueryBlocks extends ApiQueryBase {
$this->addWhereFld( 'ipb_deleted', 0 );
}
// Purge expired entries on one in every 10 queries
if ( !mt_rand( 0, 10 ) ) {
Block::purgeExpired();
}
# Filter out expired rows
$this->addWhere( 'ipb_expiry > ' . $db->addQuotes( $db->timestamp() ) );
$res = $this->select( __METHOD__ );

View file

@ -136,8 +136,7 @@ class SpecialBlockList extends SpecialPage {
case Block::TYPE_IP:
case Block::TYPE_RANGE:
list( $start, $end ) = IP::parseRange( $target );
$dbr = wfGetDB( DB_SLAVE );
$conds[] = $dbr->makeList(
$conds[] = wfGetDB( DB_SLAVE )->makeList(
[
'ipb_address' => $target,
Block::getRangeCond( $start, $end )