Reduce contention of getScopedLockAndFlush() callers by using the DB domain in the key
[lhc/web/wiklou.git] / includes / user / UserGroupMembership.php
index acd6970..170e6a0 100644 (file)
@@ -250,7 +250,7 @@ class UserGroupMembership {
                $ticket = $lbFactory->getEmptyTransactionTicket( __METHOD__ );
                $dbw = $services->getDBLoadBalancer()->getConnection( DB_MASTER );
 
-               $lockKey = $dbw->getDomainID() . ':usergroups-prune'; // specific to this wiki
+               $lockKey = "{$dbw->getDomainID()}:UserGroupMembership:purge"; // per-wiki
                $scopedLock = $dbw->getScopedLockAndFlush( $lockKey, __METHOD__, 0 );
                if ( !$scopedLock ) {
                        return false; // already running
@@ -395,12 +395,13 @@ class UserGroupMembership {
 
                // link to the group description page, if it exists
                $linkTitle = self::getGroupPage( $group );
+               $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
                if ( $linkTitle ) {
                        if ( $format === 'wiki' ) {
                                $linkPage = $linkTitle->getFullText();
                                $groupLink = "[[$linkPage|$groupName]]";
                        } else {
-                               $groupLink = Linker::link( $linkTitle, htmlspecialchars( $groupName ) );
+                               $groupLink = $linkRenderer->makeLink( $linkTitle, $groupName );
                        }
                } else {
                        $groupLink = htmlspecialchars( $groupName );