Avoid "recent-contributors" queries that cause timeouts

* This works by only scanning the last 100 edits

bug: T90036
Change-Id: I803b06f9eb7a4a61bcb0248520b4144158963983
This commit is contained in:
Aaron Schulz 2015-02-19 17:05:59 -08:00
parent 6d316690a9
commit 42120d3921

View file

@ -488,14 +488,20 @@ class AFComputedVariable {
}
$dbr = wfGetDB( DB_SLAVE );
$res = $dbr->select( 'revision',
'DISTINCT rev_user_text',
$sqlTmp = $dbr->selectSQLText(
'revision',
array( 'rev_user_text', 'rev_timestamp' ),
array(
'rev_page' => $title->getArticleID(),
'rev_timestamp<' . $dbr->addQuotes( $dbr->timestamp( $cutOff ) )
'rev_timestamp < ' . $dbr->addQuotes( $dbr->timestamp( $cutOff ) )
),
__METHOD__,
array( 'ORDER BY' => 'rev_timestamp DESC', 'LIMIT' => 10 )
// Some pages have < 10 authors but many revisions (e.g. bot pages)
array( 'ORDER BY' => 'rev_timestamp DESC', 'LIMIT' => 100 )
);
$res = $dbr->query(
"SELECT rev_user_text FROM ($sqlTmp) AS tmp " .
"GROUP BY rev_user_text ORDER BY MAX(rev_timestamp) DESC LIMIT 10"
);
$users = array();