From: Aaron Schulz Date: Wed, 23 Aug 2017 17:35:04 +0000 (-0700) Subject: Make workItemCount() smarter for htmlCacheUpdate/refreshLinks X-Git-Tag: 1.31.0-rc.0~2321 X-Git-Url: http://git.cyclocoop.org/%7B%7B%20url_for%28%27admin_vote_add%27%29%20%7D%7D?a=commitdiff_plain;h=70d1bc00919efb1cbfd00e85bbf65b8e947cbdb6;p=lhc%2Fweb%2Fwiklou.git 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 --- 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 } }