public function run() {
$lbFactory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
$lb = $lbFactory->getMainLB();
- $dbw = $lb->getConnection( DB_MASTER );
+ $dbw = $lb->getConnectionRef( DB_MASTER );
$this->ticket = $lbFactory->getEmptyTransactionTicket( __METHOD__ );
}
// Cut down on the time spent in waitForMasterPos() in the critical section
- $dbr = $lb->getConnection( DB_REPLICA, [ 'recentchanges' ] );
+ $dbr = $lb->getConnectionRef( DB_REPLICA, [ 'recentchanges' ] );
if ( !$lb->waitForMasterPos( $dbr ) ) {
$this->setLastError( "Timed out while pre-waiting for replica DB to catch up" );
return false;
}
// Use a named lock so that jobs for this page see each others' changes
- $lockKey = "CategoryMembershipUpdates:{$page->getId()}";
+ $lockKey = "{$dbw->getDomainID()}:CategoryMembershipChange:{$page->getId()}"; // per-wiki
$scopedLock = $dbw->getScopedLockAndFlush( $lockKey, __METHOD__, 3 );
if ( !$scopedLock ) {
$this->setLastError( "Could not acquire lock '$lockKey'" );