* @ingroup Maintenance
*/
-require_once( __DIR__ . '/Maintenance.php' );
+require_once __DIR__ . '/Maintenance.php';
/**
* Maintenance script that runs pending jobs.
$procs = intval( $this->getOption( 'procs' ) );
if ( $procs < 1 || $procs > 1000 ) {
$this->error( "Invalid argument to --procs", true );
- }
- $fc = new ForkController( $procs );
- if ( $fc->start() != 'child' ) {
- exit( 0 );
+ } elseif ( $procs != 1 ) {
+ $fc = new ForkController( $procs );
+ if ( $fc->start() != 'child' ) {
+ exit( 0 );
+ }
}
}
$maxJobs = $this->getOption( 'maxjobs', false );
$this->runJobsLog( "Executed $count periodic queue task(s)." );
}
+ $flags = JobQueueGroup::USE_CACHE | JobQueueGroup::USE_PRIORITY;
$lastTime = time();
do {
$job = ( $type === false )
- ? $group->pop( JobQueueGroup::TYPE_DEFAULT, JobQueueGroup::USE_CACHE )
+ ? $group->pop( JobQueueGroup::TYPE_DEFAULT, $flags )
: $group->pop( $type ); // job from a single queue
if ( $job ) { // found a job
++$jobsRun;
// Run the job...
$t = microtime( true );
+ wfProfileIn( __METHOD__ . '-' . get_class( $job ) );
try {
$status = $job->run();
$error = $job->getLastError();
} catch ( MWException $e ) {
$status = false;
$error = get_class( $e ) . ': ' . $e->getMessage();
+ wfDebugLog( 'exception', $e->getLogMessage() );
}
+ wfProfileOut( __METHOD__ . '-' . get_class( $job ) );
$timeMs = intval( ( microtime( true ) - $t ) * 1000 );
// Mark the job as done on success or when the job cannot be retried
$group->ack( $job ); // done
}
- if ( !$status ) {
+ if ( $status === false ) {
$this->runJobsLog( $job->toString() . " t=$timeMs error={$error}" );
} else {
$this->runJobsLog( $job->toString() . " t=$timeMs good" );
}
$maintClass = "RunJobs";
-require_once( RUN_MAINTENANCE_IF_MAIN );
+require_once RUN_MAINTENANCE_IF_MAIN;