[MediaWiki-commits] [Gerrit] mediawiki/core[wmf/1.30.0-wmf.15]: Make workItemCount() smarter for htmlCacheUpdate/refreshLinks

2017-08-23 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/373390 )

Change subject: Make workItemCount() smarter for htmlCacheUpdate/refreshLinks
..


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
---
M includes/jobqueue/jobs/HTMLCacheUpdateJob.php
M includes/jobqueue/jobs/RefreshLinksJob.php
2 files changed, 14 insertions(+), 2 deletions(-)

Approvals:
  Aaron Schulz: Looks good to me, approved
  Krinkle: Looks good to me, but someone else must approve
  jenkins-bot: Verified



diff --git a/includes/jobqueue/jobs/HTMLCacheUpdateJob.php 
b/includes/jobqueue/jobs/HTMLCacheUpdateJob.php
index 2d816f9..07d68e7 100644
--- a/includes/jobqueue/jobs/HTMLCacheUpdateJob.php
+++ b/includes/jobqueue/jobs/HTMLCacheUpdateJob.php
@@ -152,6 +152,12 @@
}
 
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 b4ead5d..9f3550f 100644
--- a/includes/jobqueue/jobs/RefreshLinksJob.php
+++ b/includes/jobqueue/jobs/RefreshLinksJob.php
@@ -301,6 +301,12 @@
}
 
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
}
 }

-- 
To view, visit https://gerrit.wikimedia.org/r/373390
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ide831b555e51e3111410929a598efb6c0afc0989
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: wmf/1.30.0-wmf.15
Gerrit-Owner: Ladsgroup 
Gerrit-Reviewer: Aaron Schulz 
Gerrit-Reviewer: Krinkle 
Gerrit-Reviewer: jenkins-bot <>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki/core[wmf/1.30.0-wmf.15]: Make workItemCount() smarter for htmlCacheUpdate/refreshLinks

2017-08-23 Thread Ladsgroup (Code Review)
Ladsgroup has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/373390 )

Change subject: Make workItemCount() smarter for htmlCacheUpdate/refreshLinks
..

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
---
M includes/jobqueue/jobs/HTMLCacheUpdateJob.php
M includes/jobqueue/jobs/RefreshLinksJob.php
2 files changed, 14 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/90/373390/1

diff --git a/includes/jobqueue/jobs/HTMLCacheUpdateJob.php 
b/includes/jobqueue/jobs/HTMLCacheUpdateJob.php
index 2d816f9..07d68e7 100644
--- a/includes/jobqueue/jobs/HTMLCacheUpdateJob.php
+++ b/includes/jobqueue/jobs/HTMLCacheUpdateJob.php
@@ -152,6 +152,12 @@
}
 
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 b4ead5d..9f3550f 100644
--- a/includes/jobqueue/jobs/RefreshLinksJob.php
+++ b/includes/jobqueue/jobs/RefreshLinksJob.php
@@ -301,6 +301,12 @@
}
 
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
}
 }

-- 
To view, visit https://gerrit.wikimedia.org/r/373390
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ide831b555e51e3111410929a598efb6c0afc0989
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: wmf/1.30.0-wmf.15
Gerrit-Owner: Ladsgroup 
Gerrit-Reviewer: Aaron Schulz 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits