Index: includes/DefaultSettings.php =================================================================== --- includes/DefaultSettings.php (revision 81862) +++ includes/DefaultSettings.php (working copy) @@ -4575,6 +4575,17 @@ ); /** + + * Jobs that must be explitly requested, these can be: + * + * Very long running jobs. + * Jobs that you would never want to run as part of a page rendering request. + * Jobs that you want to run on specialized machines ( like transcoding, or a particular + * machine on your cluster has 'outside' web access you could restrict uploadFromUrl ) + */ +wgJobExplicitRequestTypes = array(); + +/** * Additional functions to be performed with updateSpecialPages. * Expensive Querypages are already updated. */ Index: includes/job/JobQueue.php =================================================================== --- includes/job/JobQueue.php (revision 81862) +++ includes/job/JobQueue.php (working copy) @@ -89,6 +89,7 @@ * @return Job or false if there's no jobs */ static function pop( $offset = 0 ) { + global $wgJobExplitRequestTypes; wfProfileIn( __METHOD__ ); $dbr = wfGetDB( DB_SLAVE ); @@ -99,16 +100,22 @@ NB: If random fetch previously was used, offset will always be ahead of few entries */ - - $row = $dbr->selectRow( 'job', '*', "job_id >= ${offset}", __METHOD__, - array( 'ORDER BY' => 'job_id', 'LIMIT' => 1 ) ); + $conditions = array(); + if( count( $wgJobExplicitRequestTypes ) != 0 ){ + foreach( $wgJobExplicitRequestTypes as $cmdType){ + $conditions[] = "job_cmd != '" . $dbr->strencode( $cmdType) . "'"; + } + } + $row = $dbr->selectRow( 'job', '*', array_merge( $conditions, array( "job_id >= ${offset}" ) ) , __METHOD__, + array('ORDER BY' => 'job_id', 'LIMIT' => 1 ) + ); // Refetching without offset is needed as some of job IDs could have had delayed commits // and have lower IDs than jobs already executed, blame concurrency :) // if ( $row === false ) { if ( $offset != 0 ) { - $row = $dbr->selectRow( 'job', '*', '', __METHOD__, + $row = $dbr->selectRow( 'job', '*', $conditions, __METHOD__, array( 'ORDER BY' => 'job_id', 'LIMIT' => 1 ) ); }