From 47529179e946abdb4b01aa92490f5f1c11c619e4 Mon Sep 17 00:00:00 2001 From: Chad Horohoe Date: Fri, 4 Feb 2011 15:03:59 +0000 Subject: [PATCH] Revert r73198 (adding exclusing option to runJobs.php). Per CR, this should use a real pool counter. --- maintenance/runJobs.php | 32 ++++---------------------------- 1 file changed, 4 insertions(+), 28 deletions(-) diff --git a/maintenance/runJobs.php b/maintenance/runJobs.php index a10003429e..f601a7e2dd 100644 --- a/maintenance/runJobs.php +++ b/maintenance/runJobs.php @@ -2,6 +2,10 @@ /** * This script starts pending jobs. * + * Usage: + * --maxjobs (default 10000) + * --type + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or @@ -29,7 +33,6 @@ class RunJobs extends Maintenance { $this->addOption( 'maxjobs', 'Maximum number of jobs to run', false, true ); $this->addOption( 'type', 'Type of job to run', false, true ); $this->addOption( 'procs', 'Number of processes to use', false, true ); - $this->addOption( 'exclusive', 'Run only one exclusive runJobs script at a time. Timeout is 1800 seconds. Useful for cron scripts.', false ); } public function memoryLimit() { @@ -38,10 +41,6 @@ class RunJobs extends Maintenance { } public function execute() { - if ( $this->lock() === false ) { - exit( 0 ); - } - global $wgTitle; if ( $this->hasOption( 'procs' ) ) { $procs = intval( $this->getOption( 'procs' ) ); @@ -50,7 +49,6 @@ class RunJobs extends Maintenance { } $fc = new ForkController( $procs ); if ( $fc->start() != 'child' ) { - $this->unlock(); exit( 0 ); } } @@ -87,9 +85,6 @@ class RunJobs extends Maintenance { } } } - if ( !$this->hasOption( 'procs' ) ) { - $this->unlock(); - } } /** @@ -100,25 +95,6 @@ class RunJobs extends Maintenance { $this->output( wfTimestamp( TS_DB ) . " $msg\n" ); wfDebugLog( 'runJobs', $msg ); } - - protected function lock() { - if ( $this->hasOption( 'exclusive' ) ) { - $cache = wfGetCache( CACHE_ANYTHING ); - $running = $cache->get( wfMemcKey( 'runjobs' ) ); - if ( $running ) { - return false; - } else { - $cache->set( wfMemcKey( 'runjobs' ), '1', 1800 ); - return true; - } - } - return true; - } - - protected function unlock() { - wfGetCache( CACHE_ANYTHING )->delete( wfMemcKey( 'runjobs' ) ); - } - } $maintClass = "RunJobs"; -- 2.20.1