Gergő Tisza has uploaded a new change for review. https://gerrit.wikimedia.org/r/132111
Change subject: Allow floating point values for $wgJobBackoffThrottling ...................................................................... Allow floating point values for $wgJobBackoffThrottling Useful for jobs which take longer than a second to finish. Change-Id: I2e57d61fd67b97fbd593274b31e1bfada8f522f5 --- M includes/DefaultSettings.php M maintenance/runJobs.php 2 files changed, 5 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/11/132111/1 diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 0ca35f0..efe02f6 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -6178,6 +6178,7 @@ * 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. + * @type float[] */ $wgJobBackoffThrottling = array(); diff --git a/maintenance/runJobs.php b/maintenance/runJobs.php index f69a3a3..bc5653b 100644 --- a/maintenance/runJobs.php +++ b/maintenance/runJobs.php @@ -190,8 +190,10 @@ $seconds = 0; if ( $job->workItemCount() > 0 ) { $seconds = floor( $job->workItemCount() / $itemsPerSecond ); - $remainder = $job->workItemCount() % $itemsPerSecond; - $seconds += ( mt_rand( 1, $itemsPerSecond ) <= $remainder ) ? 1 : 0; + if ( $itemsPerSecond >= 2 ) { + $remainder = fmod( $job->workItemCount(), $itemsPerSecond ); + $seconds += ( mt_rand( 1, floor( $itemsPerSecond ) ) <= $remainder ) ? 1 : 0; + } } return (int)$seconds; -- To view, visit https://gerrit.wikimedia.org/r/132111 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I2e57d61fd67b97fbd593274b31e1bfada8f522f5 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Gergő Tisza <gti...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits