From: Aaron Schulz Date: Thu, 3 Apr 2014 01:20:16 +0000 (-0700) Subject: Made runJobs.php fully respect $wgJobBackoffThrottling X-Git-Tag: 1.31.0-rc.0~16320^2 X-Git-Url: https://git.cyclocoop.org/%27.WWW_URL.%27admin/?a=commitdiff_plain;h=0929a1fba8ce5914848b7516bcf1dfb44c853e11;p=lhc%2Fweb%2Fwiklou.git Made runJobs.php fully respect $wgJobBackoffThrottling * Previously, it did not if --type was used * A --nothrottle option was added to ignore throttling Change-Id: Ib3ca899f1ce30250a63084096f1b660c96e359fe --- diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index bb5d26d08c..fb3078dbe8 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -6207,6 +6207,7 @@ $wgJobTypesExcludedFromDefaultQueue = array( 'AssembleUploadChunks', 'PublishSta * on each job runner process. The meaning of "work items" varies per job, * but typically would be something like "pages to update". A single job * may have a variable number of work items, as is the case with batch jobs. + * This is used by runJobs.php and not jobs run via $wgJobRunRate. * These settings should be global to all wikis. */ $wgJobBackoffThrottling = array(); diff --git a/maintenance/runJobs.php b/maintenance/runJobs.php index f7d5fc07e7..0926f41c5c 100644 --- a/maintenance/runJobs.php +++ b/maintenance/runJobs.php @@ -36,6 +36,7 @@ class RunJobs extends Maintenance { $this->addOption( 'maxtime', 'Maximum amount of wall-clock time', false, true ); $this->addOption( 'type', 'Type of job to run', false, true ); $this->addOption( 'procs', 'Number of processes to use', false, true ); + $this->addOption( 'nothrottle', 'Ignore job throttling configuration', false, false ); } public function memoryLimit() { @@ -66,6 +67,7 @@ class RunJobs extends Maintenance { $type = $this->getOption( 'type', false ); $maxJobs = $this->getOption( 'maxjobs', false ); $maxTime = $this->getOption( 'maxtime', false ); + $noThrottle = $this->hasOption( 'nothrottle' ); $startTime = time(); $group = JobQueueGroup::singleton(); @@ -83,10 +85,12 @@ class RunJobs extends Maintenance { $flags = JobQueueGroup::USE_CACHE; $lastTime = time(); // time since last slave check do { + $backoffs = array_filter( $backoffs, $backoffExpireFunc ); + $blacklist = $noThrottle ? array() : array_keys( $backoffs ); if ( $type === false ) { - $backoffs = array_filter( $backoffs, $backoffExpireFunc ); - $blacklist = array_keys( $backoffs ); $job = $group->pop( JobQueueGroup::TYPE_DEFAULT, $flags, $blacklist ); + } elseif ( in_array( $type, $blacklist ) ) { + $job = false; // requested queue in backoff state } else { $job = $group->pop( $type ); // job from a single queue }