Avoid begin/commit in Category::getCountMessage()

Change-Id: I64e4a859a9adf2930265e282f59816c82e1c3070
This commit is contained in:
Aaron Schulz 2014-06-24 18:07:55 -07:00
parent baa3183899
commit e79535a582
2 changed files with 6 additions and 3 deletions

View file

@ -320,7 +320,7 @@ class Category {
wfProfileIn( __METHOD__ );
$dbw = wfGetDB( DB_MASTER );
$dbw->begin( __METHOD__ );
$dbw->startAtomic( __METHOD__ );
# Insert the row if it doesn't exist yet (e.g., this is being run via
# update.php from a pre-1.16 schema). TODO: This will cause lots and
@ -360,7 +360,7 @@ class Category {
array( 'cat_title' => $this->mName ),
__METHOD__
);
$dbw->commit( __METHOD__ );
$dbw->endAtomic( __METHOD__ );
wfProfileOut( __METHOD__ );

View file

@ -707,7 +707,10 @@ class CategoryViewer extends ContextSource {
// to refresh the incorrect category table entry -- which should be
// quick due to the small number of entries.
$totalcnt = $rescnt;
$this->cat->refreshCounts();
$category = $this->cat;
wfGetDB( DB_MASTER )->onTransactionIdle( function() use ( $category ) {
$category->refreshCounts();
} );
} else {
// Case 3: hopeless. Don't give a total count at all.
// Messages: category-subcat-count-limited, category-article-count-limited,