From 2cb965c5a5393a168fe71561e5dfe8d2bb9fce98 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Thu, 19 Oct 2017 12:39:56 -0700 Subject: [PATCH] Set getDeduplicationInfo() for HTMLCacheUpdateJob This allows de-duplication of single page jobs for the same page due to edits to different templates. This is the same logic that RefreshLinksJob already has. Also fix a bug in that method in RefreshLinksJob. Change-Id: I2f79031c945eb3d195f9dbda949077bbc3e67918 --- includes/jobqueue/jobs/HTMLCacheUpdateJob.php | 14 ++++++++++++++ includes/jobqueue/jobs/RefreshLinksJob.php | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/includes/jobqueue/jobs/HTMLCacheUpdateJob.php b/includes/jobqueue/jobs/HTMLCacheUpdateJob.php index e8edab59b4..4d75cb303c 100644 --- a/includes/jobqueue/jobs/HTMLCacheUpdateJob.php +++ b/includes/jobqueue/jobs/HTMLCacheUpdateJob.php @@ -169,6 +169,20 @@ class HTMLCacheUpdateJob extends Job { } } + public function getDeduplicationInfo() { + $info = parent::getDeduplicationInfo(); + if ( is_array( $info['params'] ) ) { + // For per-pages jobs, the job title is that of the template that changed + // (or similar), so remove that since it ruins duplicate detection + if ( isset( $info['params']['pages'] ) ) { + unset( $info['namespace'] ); + unset( $info['title'] ); + } + } + + return $info; + } + public function workItemCount() { if ( !empty( $this->params['recursive'] ) ) { return 0; // nothing actually purged diff --git a/includes/jobqueue/jobs/RefreshLinksJob.php b/includes/jobqueue/jobs/RefreshLinksJob.php index 424fcecb2d..51e964d54f 100644 --- a/includes/jobqueue/jobs/RefreshLinksJob.php +++ b/includes/jobqueue/jobs/RefreshLinksJob.php @@ -291,7 +291,7 @@ class RefreshLinksJob extends Job { if ( is_array( $info['params'] ) ) { // For per-pages jobs, the job title is that of the template that changed // (or similar), so remove that since it ruins duplicate detection - if ( isset( $info['pages'] ) ) { + if ( isset( $info['params']['pages'] ) ) { unset( $info['namespace'] ); unset( $info['title'] ); } -- 2.20.1