r81520 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r81519‎ | r81520 | r81521 >
Date:15:06, 4 February 2011
Author:demon
Status:ok
Tags:
Comment:
MFT r81519
Modified paths:
  • /branches/REL1_17/phase3/maintenance (modified) (history)
  • /branches/REL1_17/phase3/maintenance/runJobs.php (modified) (history)

Diff [purge]

Index: branches/REL1_17/phase3/maintenance/runJobs.php
@@ -2,6 +2,10 @@
33 /**
44 * This script starts pending jobs.
55 *
 6+ * Usage:
 7+ * --maxjobs <num> (default 10000)
 8+ * --type <job_cmd>
 9+ *
610 * This program is free software; you can redistribute it and/or modify
711 * it under the terms of the GNU General Public License as published by
812 * the Free Software Foundation; either version 2 of the License, or
@@ -29,7 +33,6 @@
3034 $this->addOption( 'maxjobs', 'Maximum number of jobs to run', false, true );
3135 $this->addOption( 'type', 'Type of job to run', false, true );
3236 $this->addOption( 'procs', 'Number of processes to use', false, true );
33 - $this->addOption( 'exclusive', 'Run only one exclusive runJobs script at a time. Timeout is 1800 seconds. Useful for cron scripts.', false );
3437 }
3538
3639 public function memoryLimit() {
@@ -38,10 +41,6 @@
3942 }
4043
4144 public function execute() {
42 - if ( $this->lock() === false ) {
43 - exit( 0 );
44 - }
45 -
4645 global $wgTitle;
4746 if ( $this->hasOption( 'procs' ) ) {
4847 $procs = intval( $this->getOption( 'procs' ) );
@@ -50,7 +49,6 @@
5150 }
5251 $fc = new ForkController( $procs );
5352 if ( $fc->start( $procs ) != 'child' ) {
54 - $this->unlock();
5553 exit( 0 );
5654 }
5755 }
@@ -87,9 +85,6 @@
8886 }
8987 }
9088 }
91 - if ( !$this->hasOption( 'procs' ) ) {
92 - $this->unlock();
93 - }
9489 }
9590
9691 /**
@@ -100,25 +95,6 @@
10196 $this->output( wfTimestamp( TS_DB ) . " $msg\n" );
10297 wfDebugLog( 'runJobs', $msg );
10398 }
104 -
105 - protected function lock() {
106 - if ( $this->hasOption( 'exclusive' ) ) {
107 - $cache = wfGetCache( CACHE_ANYTHING );
108 - $running = $cache->get( wfMemcKey( 'runjobs' ) );
109 - if ( $running ) {
110 - return false;
111 - } else {
112 - $cache->set( wfMemcKey( 'runjobs' ), '1', 1800 );
113 - return true;
114 - }
115 - }
116 - return true;
117 - }
118 -
119 - protected function unlock() {
120 - wfGetCache( CACHE_ANYTHING )->delete( wfMemcKey( 'runjobs' ) );
121 - }
122 -
12399 }
124100
125101 $maintClass = "RunJobs";
Property changes on: branches/REL1_17/phase3/maintenance
___________________________________________________________________
Added: svn:mergeinfo
126102 Merged /branches/REL1_15/phase3/maintenance:r51646
127103 Merged /branches/sqlite/maintenance:r58211-58321
128104 Merged /trunk/phase3/maintenance:r79828,79830,79848,79853,79950-79951,79954,79989,80006-80007,80013,80016,80080,80083,80124,80128,80238,81519
129105 Merged /branches/new-installer/phase3/maintenance:r43664-66004

Follow-up revisions

RevisionCommit summaryAuthorDate
r816561.17wmf1: Merge r81520, r81654 from REL1_17catrope23:01, 7 February 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r81519Revert r73198 (adding exclusing option to runJobs.php). Per CR, this should u...demon15:03, 4 February 2011

Status & tagging log