From 70d1bc00919efb1cbfd00e85bbf65b8e947cbdb6 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Wed, 23 Aug 2017 10:35:04 -0700 Subject: [PATCH] Make workItemCount() smarter for htmlCacheUpdate/refreshLinks Do not count jobs that just make subdivide as having any "work items". This makes $wgJobBackoffThrottling less overzealous when used to limit these type of jobs. The main reason to limit htmlCacheUpdate would be for CDN purge rate limiting. For refreshLinks, it would mostly be lag, though that is already handled for leaf jobs and JobRunner itself. Bug: T173710 Change-Id: Ide831b555e51e3111410929a598efb6c0afc0989 --- includes/jobqueue/jobs/HTMLCacheUpdateJob.php | 8 +++++++- includes/jobqueue/jobs/RefreshLinksJob.php | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/includes/jobqueue/jobs/HTMLCacheUpdateJob.php b/includes/jobqueue/jobs/HTMLCacheUpdateJob.php index 2d816f9f06..07d68e76f5 100644 --- a/includes/jobqueue/jobs/HTMLCacheUpdateJob.php +++ b/includes/jobqueue/jobs/HTMLCacheUpdateJob.php @@ -152,6 +152,12 @@ class HTMLCacheUpdateJob extends Job { } public function workItemCount() { - return isset( $this->params['pages'] ) ? count( $this->params['pages'] ) : 1; + if ( !empty( $this->params['recursive'] ) ) { + return 0; // nothing actually purged + } elseif ( isset( $this->params['pages'] ) ) { + return count( $this->params['pages'] ); + } + + return 1; // one title } } diff --git a/includes/jobqueue/jobs/RefreshLinksJob.php b/includes/jobqueue/jobs/RefreshLinksJob.php index b4ead5d568..9f3550f269 100644 --- a/includes/jobqueue/jobs/RefreshLinksJob.php +++ b/includes/jobqueue/jobs/RefreshLinksJob.php @@ -301,6 +301,12 @@ class RefreshLinksJob extends Job { } public function workItemCount() { - return isset( $this->params['pages'] ) ? count( $this->params['pages'] ) : 1; + if ( !empty( $this->params['recursive'] ) ) { + return 0; // nothing actually refreshed + } elseif ( isset( $this->params['pages'] ) ) { + return count( $this->params['pages'] ); + } + + return 1; // one title } } -- 2.20.1