dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge "LoginSignupSpecialPage: Reduce hackiness of "You are already logged in" warning"
[lhc/web/wiklou.git]
/
includes
/
jobqueue
/
jobs
/
RefreshLinksJob.php
diff --git
a/includes/jobqueue/jobs/RefreshLinksJob.php
b/includes/jobqueue/jobs/RefreshLinksJob.php
index
9cdb161
..
5f33ae0
100644
(file)
--- a/
includes/jobqueue/jobs/RefreshLinksJob.php
+++ b/
includes/jobqueue/jobs/RefreshLinksJob.php
@@
-40,7
+40,7
@@
class RefreshLinksJob extends Job {
const PARSE_THRESHOLD_SEC = 1.0;
/** @var integer Lag safety margin when comparing root job times to last-refresh times */
const CLOCK_FUDGE = 10;
const PARSE_THRESHOLD_SEC = 1.0;
/** @var integer Lag safety margin when comparing root job times to last-refresh times */
const CLOCK_FUDGE = 10;
- /** @var integer How many seconds to wait for
slave
s to catch up */
+ /** @var integer How many seconds to wait for
replica DB
s to catch up */
const LAG_WAIT_TIMEOUT = 15;
function __construct( Title $title, array $params ) {
const LAG_WAIT_TIMEOUT = 15;
function __construct( Title $title, array $params ) {
@@
-83,12
+83,13
@@
class RefreshLinksJob extends Job {
// Job to update all (or a range of) backlink pages for a page
if ( !empty( $this->params['recursive'] ) ) {
// Job to update all (or a range of) backlink pages for a page
if ( !empty( $this->params['recursive'] ) ) {
- // When the base job branches, wait for the
slave
s to catch up to the master.
+ // When the base job branches, wait for the
replica DB
s to catch up to the master.
// From then on, we know that any template changes at the time the base job was
// enqueued will be reflected in backlink page parses when the leaf jobs run.
if ( !isset( $params['range'] ) ) {
try {
// From then on, we know that any template changes at the time the base job was
// enqueued will be reflected in backlink page parses when the leaf jobs run.
if ( !isset( $params['range'] ) ) {
try {
- wfGetLBFactory()->waitForReplication( [
+ $lbFactory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
+ $lbFactory->waitForReplication( [
'wiki' => wfWikiID(),
'timeout' => self::LAG_WAIT_TIMEOUT
] );
'wiki' => wfWikiID(),
'timeout' => self::LAG_WAIT_TIMEOUT
] );
@@
-128,13
+129,18
@@
class RefreshLinksJob extends Job {
* @return bool
*/
protected function runForTitle( Title $title ) {
* @return bool
*/
protected function runForTitle( Title $title ) {
- $stats = MediaWikiServices::getInstance()->getStatsdDataFactory();
+ $services = MediaWikiServices::getInstance();
+ $stats = $services->getStatsdDataFactory();
+ $lbFactory = $services->getDBLoadBalancerFactory();
+ $ticket = $lbFactory->getEmptyTransactionTicket( __METHOD__ );
$page = WikiPage::factory( $title );
$page->loadPageData( WikiPage::READ_LATEST );
// Serialize links updates by page ID so they see each others' changes
$page = WikiPage::factory( $title );
$page->loadPageData( WikiPage::READ_LATEST );
// Serialize links updates by page ID so they see each others' changes
- $scopedLock = LinksUpdate::acquirePageLock( wfGetDB( DB_MASTER ), $page->getId(), 'job' );
+ $dbw = $lbFactory->getMainLB()->getConnection( DB_MASTER );
+ /** @noinspection PhpUnusedLocalVariableInspection */
+ $scopedLock = LinksUpdate::acquirePageLock( $dbw, $page->getId(), 'job' );
// Get the latest ID *after* acquirePageLock() flushed the transaction.
// This is used to detect edits/moves after loadPageData() but before the scope lock.
// The works around the chicken/egg problem of determining the scope lock key.
// Get the latest ID *after* acquirePageLock() flushed the transaction.
// This is used to detect edits/moves after loadPageData() but before the scope lock.
// The works around the chicken/egg problem of determining the scope lock key.
@@
-182,7
+188,7
@@
class RefreshLinksJob extends Job {
$skewedTimestamp = $this->params['rootJobTimestamp'];
if ( $opportunistic ) {
$skewedTimestamp = $this->params['rootJobTimestamp'];
if ( $opportunistic ) {
- // Neither clock skew nor DB snapshot/
slave
lag matter much for such
+ // Neither clock skew nor DB snapshot/
replica DB
lag matter much for such
// updates; focus on reusing the (often recently updated) cache
} else {
// For transclusion updates, the template changes must be reflected
// updates; focus on reusing the (often recently updated) cache
} else {
// For transclusion updates, the template changes must be reflected
@@
-241,10
+247,7
@@
class RefreshLinksJob extends Job {
$parserOutput
);
$parserOutput
);
- $factory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
- $ticket = $factory->getEmptyTransactionTicket( __METHOD__ );
foreach ( $updates as $key => $update ) {
foreach ( $updates as $key => $update ) {
- $update->setTransactionTicket( $ticket );
// FIXME: This code probably shouldn't be here?
// Needed by things like Echo notifications which need
// to know which user caused the links update
// FIXME: This code probably shouldn't be here?
// Needed by things like Echo notifications which need
// to know which user caused the links update
@@
-263,7
+266,10
@@
class RefreshLinksJob extends Job {
}
}
}
}
- DataUpdate::runUpdates( $updates );
+ foreach ( $updates as $update ) {
+ $update->setTransactionTicket( $ticket );
+ $update->doUpdate();
+ }
InfoAction::invalidateCache( $title );
InfoAction::invalidateCache( $title );