Aaron Schulz has uploaded a new change for review.
https://gerrit.wikimedia.org/r/59797
Change subject: Changed on-request job running to shell out instead of doing a
loop.
......................................................................
Changed on-request job running to shell out instead of doing a loop.
* This will keep the process in the background if possible to avoid
killing site performance, especially with slow jobs.
* This also avoids some duplication and divergence with runJobs.php.
Change-Id: I6a28152251659ee53eee2604f16d5bf02c85a44f
---
M includes/Wiki.php
1 file changed, 9 insertions(+), 19 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/97/59797/1
diff --git a/includes/Wiki.php b/includes/Wiki.php
index f8f699c..5ea135e 100644
--- a/includes/Wiki.php
+++ b/includes/Wiki.php
@@ -599,7 +599,7 @@
* Do a job from the job queue
*/
private function doJobs() {
- global $wgJobRunRate;
+ global $wgJobRunRate, $IP;
if ( $wgJobRunRate <= 0 || wfReadOnly() ) {
return;
@@ -615,23 +615,13 @@
$n = intval( $wgJobRunRate );
}
- $group = JobQueueGroup::singleton();
- do {
- $job = $group->pop( JobQueueGroup::USE_CACHE ); // job
from any queue
- if ( $job ) {
- $output = $job->toString() . "\n";
- $t = - microtime( true );
- $success = $job->run();
- $group->ack( $job ); // done
- $t += microtime( true );
- $t = round( $t * 1000 );
- if ( !$success ) {
- $output .= "Error: " .
$job->getLastError() . ", Time: $t ms\n";
- } else {
- $output .= "Success, Time: $t ms\n";
- }
- wfDebugLog( 'jobqueue', $output );
- }
- } while ( --$n && $job );
+ // Start a background process to run some of the jobs.
+ // This will be asynchronous on *nix and but not on Windows.
+ $retVal = 1;
+ $cmd = wfShellWikiCmd( "$IP/maintenance/runJobs.php", array(
'--maxjobs', 3 ) );
+ wfShellExec( "$cmd &", $retVal );
+ if ( $retVal != 0 ) {
+ wfDebugLog( 'JobQueue', __METHOD__ . ": Failed to spawn
runJobs.php." );
+ }
}
}
--
To view, visit https://gerrit.wikimedia.org/r/59797
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I6a28152251659ee53eee2604f16d5bf02c85a44f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits