parent::__construct();
$this->mDescription = "Run pending jobs";
$this->addOption( 'maxjobs', 'Maximum number of jobs to run', false, true );
+ $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 );
}
exit( 0 );
}
}
- $maxJobs = $this->getOption( 'maxjobs', 10000 );
+ $maxJobs = $this->getOption( 'maxjobs', false );
+ $maxTime = $this->getOption( 'maxtime', false );
+ $startTime = time();
$type = $this->getOption( 'type', false );
$wgTitle = Title::newFromText( 'RunJobs.php' );
$dbw = wfGetDB( DB_MASTER );
} else {
$this->runJobsLog( $job->toString() . " t=$timeMs good" );
}
+
if ( $maxJobs && ++$n > $maxJobs ) {
break 2;
}
+ if ( $maxTime && time() - $startTime > $maxTime ) {
+ break 2;
+ }
}
}
}