++$jobsRun;
$this->runJobsLog( $job->toString() . " STARTING" );
- // Set timer to stop the job if too much CPU time is used
- set_time_limit( $maxTime ? : 0 );
// Run the job...
wfProfileIn( __METHOD__ . '-' . get_class( $job ) );
$t = microtime( true );
}
$timeMs = intval( ( microtime( true ) - $t ) * 1000 );
wfProfileOut( __METHOD__ . '-' . get_class( $job ) );
- // Disable the timer
- set_time_limit( 0 );
// Mark the job as done on success or when the job cannot be retried
if ( $status !== false || !$job->allowRetries() ) {
$this->runJobsLog( $job->toString() . " t=$timeMs good" );
}
- // Back off of certain jobs for a while
+ // Back off of certain jobs for a while (for throttling and for errors)
$ttw = $this->getBackoffTimeToWait( $job );
+ if ( $status === false && mt_rand( 0, 49 ) == 0 ) {
+ $ttw = max( $ttw, 30 );
+ }
if ( $ttw > 0 ) {
$jType = $job->getType();
$backoffs[$jType] = isset( $backoffs[$jType] ) ? $backoffs[$jType] : 0;