From e96c81bab59f8d099c6e3a897b359b464aed9192 Mon Sep 17 00:00:00 2001 From: Brad Jorsch Date: Mon, 2 May 2016 16:36:10 -0400 Subject: [PATCH] Quick-fail refreshLinksJob if the triggering revision isn't the latest If we already know that the triggeringRevisionId is outdated, fail early instead of doing all the work of re-parsing that old revision and preparing all the updates only to fail later at the lockAndGetLatest() call. Change-Id: Ic70c659899d5d47e74fa17c88ed26b436732ca8a --- includes/jobqueue/jobs/RefreshLinksJob.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/includes/jobqueue/jobs/RefreshLinksJob.php b/includes/jobqueue/jobs/RefreshLinksJob.php index 927cafd7ac..c2977152f2 100644 --- a/includes/jobqueue/jobs/RefreshLinksJob.php +++ b/includes/jobqueue/jobs/RefreshLinksJob.php @@ -154,6 +154,13 @@ class RefreshLinksJob extends Job { return false; // just deleted? } + if ( !$revision->isCurrent() ) { + // If the revision isn't current, there's no point in doing a bunch + // of work just to fail at the lockAndGetLatest() check later. + $this->setLastError( "Revision {$revision->getId()} is not current" ); + return false; + } + $content = $revision->getContent( Revision::RAW ); if ( !$content ) { // If there is no content, pretend the content is empty -- 2.20.1