Index: trunk/phase3/maintenance/runJobs.php |
— | — | @@ -31,6 +31,7 @@ |
32 | 32 | parent::__construct(); |
33 | 33 | $this->mDescription = "Run pending jobs"; |
34 | 34 | $this->addOption( 'maxjobs', 'Maximum number of jobs to run', false, true ); |
| 35 | + $this->addOption( 'maxtime', 'Maximum amount of wall-clock time', false, true ); |
35 | 36 | $this->addOption( 'type', 'Type of job to run', false, true ); |
36 | 37 | $this->addOption( 'procs', 'Number of processes to use', false, true ); |
37 | 38 | } |
— | — | @@ -52,7 +53,9 @@ |
53 | 54 | exit( 0 ); |
54 | 55 | } |
55 | 56 | } |
56 | | - $maxJobs = $this->getOption( 'maxjobs', 10000 ); |
| 57 | + $maxJobs = $this->getOption( 'maxjobs', false ); |
| 58 | + $maxTime = $this->getOption( 'maxtime', false ); |
| 59 | + $startTime = time(); |
57 | 60 | $type = $this->getOption( 'type', false ); |
58 | 61 | $wgTitle = Title::newFromText( 'RunJobs.php' ); |
59 | 62 | $dbw = wfGetDB( DB_MASTER ); |
— | — | @@ -80,9 +83,13 @@ |
81 | 84 | } else { |
82 | 85 | $this->runJobsLog( $job->toString() . " t=$timeMs good" ); |
83 | 86 | } |
| 87 | + |
84 | 88 | if ( $maxJobs && ++$n > $maxJobs ) { |
85 | 89 | break 2; |
86 | 90 | } |
| 91 | + if ( $maxTime && time() - $startTime > $maxTime ) { |
| 92 | + break 2; |
| 93 | + } |
87 | 94 | } |
88 | 95 | } |
89 | 96 | } |