dépôts
/
lhc
/
web
/
wiklou.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
(from parent 1:
4cc1c97
)
Merge "Reduce contention during view-based category count refreshes"
author
jenkins-bot
<jenkins-bot@gerrit.wikimedia.org>
Thu, 6 Apr 2017 01:30:44 +0000
(
01:30
+0000)
committer
Gerrit Code Review
<gerrit@wikimedia.org>
Thu, 6 Apr 2017 01:30:44 +0000
(
01:30
+0000)
includes/CategoryViewer.php
patch
|
blob
|
history
diff --git
a/includes/CategoryViewer.php
b/includes/CategoryViewer.php
index
31369b0
..
0205d70
100644
(file)
--- a/
includes/CategoryViewer.php
+++ b/
includes/CategoryViewer.php
@@
-742,7
+742,13
@@
class CategoryViewer extends ContextSource {
$totalcnt = $rescnt;
$category = $this->cat;
DeferredUpdates::addCallableUpdate( function () use ( $category ) {
- $category->refreshCounts();
+ # Avoid excess contention on the same category (T162121)
+ $dbw = wfGetDB( DB_MASTER );
+ $name = __METHOD__ . ':' . md5( $this->mName );
+ $scopedLock = $dbw->getScopedLockAndFlush( $name, __METHOD__, 1 );
+ if ( $scopedLock ) {
+ $category->refreshCounts();
+ }
} );
} else {
// Case 3: hopeless. Don't give a total count at all.