From: Aaron Schulz Date: Wed, 25 Jun 2014 01:07:55 +0000 (-0700) Subject: Avoid begin/commit in Category::getCountMessage() X-Git-Tag: 1.31.0-rc.0~15214^2 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/membres/message.php?a=commitdiff_plain;h=e79535a582ea9ba22e6fb5e1d5ab13dc7dae38e4;p=lhc%2Fweb%2Fwiklou.git Avoid begin/commit in Category::getCountMessage() Change-Id: I64e4a859a9adf2930265e282f59816c82e1c3070 --- diff --git a/includes/Category.php b/includes/Category.php index e235e4e94e..7bab464bf7 100644 --- a/includes/Category.php +++ b/includes/Category.php @@ -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__ ); diff --git a/includes/CategoryViewer.php b/includes/CategoryViewer.php index 49818e6a12..cd9eaa9c10 100644 --- a/includes/CategoryViewer.php +++ b/includes/CategoryViewer.php @@ -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,