X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FrunJobs.php;h=b488fe94b22e9c9058fff8f6824cd5625d245356;hb=f856a480b9dc99e62bdeb33df5abe213ac9e0f4f;hp=13f526c48bd5b577553ba6569bda81ef3902c015;hpb=79ebb4b0288b709fb53cff8f7ebc5f50221931c9;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/runJobs.php b/maintenance/runJobs.php index 13f526c48b..b488fe94b2 100644 --- a/maintenance/runJobs.php +++ b/maintenance/runJobs.php @@ -43,6 +43,7 @@ class RunJobs extends Maintenance { if ( $this->hasOption( 'memory-limit' ) ) { return parent::memoryLimit(); } + // Don't eat all memory on the machine if we get a bad job. return "150M"; } @@ -79,7 +80,9 @@ class RunJobs extends Maintenance { $backoffs = $this->loadBackoffs(); // map of (type => UNIX expiry) $startingBackoffs = $backoffs; // avoid unnecessary writes - $backoffExpireFunc = function( $t ) { return $t > time(); }; + $backoffExpireFunc = function ( $t ) { + return $t > time(); + }; $jobsRun = 0; // counter $flags = JobQueueGroup::USE_CACHE; @@ -99,7 +102,7 @@ class RunJobs extends Maintenance { $this->runJobsLog( $job->toString() . " STARTING" ); // Set timer to stop the job if too much CPU time is used - set_time_limit( $maxTime ?: 0 ); + set_time_limit( $maxTime ? : 0 ); // Run the job... wfProfileIn( __METHOD__ . '-' . get_class( $job ) ); $t = microtime( true ); @@ -207,7 +210,7 @@ class RunJobs extends Maintenance { $content = stream_get_contents( $handle ); flock( $handle, LOCK_UN ); fclose( $handle ); - $backoffs = json_decode( $content, true ) ?: array(); + $backoffs = json_decode( $content, true ) ? : array(); } return $backoffs; @@ -225,7 +228,7 @@ class RunJobs extends Maintenance { $handle = fopen( $file, 'wb+' ); flock( $handle, LOCK_EX ); $content = stream_get_contents( $handle ); - $cBackoffs = json_decode( $content, true ) ?: array(); + $cBackoffs = json_decode( $content, true ) ? : array(); foreach ( $backoffs as $type => $timestamp ) { $cBackoffs[$type] = isset( $cBackoffs[$type] ) ? $cBackoffs[$type] : 0; $cBackoffs[$type] = max( $cBackoffs[$type], $backoffs[$type] );