From d0c373fdf2f28e9b541daa68e5b0e97666099dcf Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Thu, 14 Sep 2017 11:25:23 +0200 Subject: [PATCH] De-duplicate HTMLCacheUpdate jobs with a page array of size 1 BacklinkJobUtils consistently uses the "pages" field in leaf jobs, even when there is only one page per leaf job. RefreshLinksJob already has this logic for de-duplication. Change-Id: Ia189bbc9df44f2161cfed4192c23b2ac3cfa65ce --- includes/jobqueue/jobs/HTMLCacheUpdateJob.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/includes/jobqueue/jobs/HTMLCacheUpdateJob.php b/includes/jobqueue/jobs/HTMLCacheUpdateJob.php index 4c16d7f25b..0aa33cac18 100644 --- a/includes/jobqueue/jobs/HTMLCacheUpdateJob.php +++ b/includes/jobqueue/jobs/HTMLCacheUpdateJob.php @@ -38,8 +38,15 @@ use MediaWiki\MediaWikiServices; class HTMLCacheUpdateJob extends Job { function __construct( Title $title, array $params ) { parent::__construct( 'htmlCacheUpdate', $title, $params ); - // Base backlink purge jobs can be de-duplicated - $this->removeDuplicates = ( !isset( $params['range'] ) && !isset( $params['pages'] ) ); + // Avoid the overhead of de-duplication when it would be pointless. + // Note that these jobs always set page_touched to the current time, + // so letting the older existing job "win" is still correct. + $this->removeDuplicates = ( + // Ranges rarely will line up + !isset( $params['range'] ) && + // Multiple pages per job make matches unlikely + !( isset( $params['pages'] ) && count( $params['pages'] ) != 1 ) + ); } /** -- 2.20.1