Index: trunk/phase3/includes/DefaultSettings.php |
— | — | @@ -4652,6 +4652,18 @@ |
4653 | 4653 | $wgExcludeFromThumbnailPurge = array(); |
4654 | 4654 | |
4655 | 4655 | /** |
| 4656 | + |
| 4657 | + * Jobs that must be explicitly requested, i.e. aren't run by job runners unless special flags are set. |
| 4658 | + * |
| 4659 | + * These can be: |
| 4660 | + * - Very long-running jobs. |
| 4661 | + * - Jobs that you would never want to run as part of a page rendering request. |
| 4662 | + * - Jobs that you want to run on specialized machines ( like transcoding, or a particular |
| 4663 | + * machine on your cluster has 'outside' web access you could restrict uploadFromUrl ) |
| 4664 | + */ |
| 4665 | +$wgJobTypesExcludedFromDefaultQueue = array(); |
| 4666 | + |
| 4667 | +/** |
4656 | 4668 | * Additional functions to be performed with updateSpecialPages. |
4657 | 4669 | * Expensive Querypages are already updated. |
4658 | 4670 | */ |
Index: trunk/phase3/includes/job/JobQueue.php |
— | — | @@ -95,6 +95,7 @@ |
96 | 96 | * @return Job or false if there's no jobs |
97 | 97 | */ |
98 | 98 | static function pop( $offset = 0 ) { |
| 99 | + global $wgJobTypesExcludedFromDefaultQueue; |
99 | 100 | wfProfileIn( __METHOD__ ); |
100 | 101 | |
101 | 102 | $dbr = wfGetDB( DB_SLAVE ); |
— | — | @@ -105,16 +106,23 @@ |
106 | 107 | NB: If random fetch previously was used, offset |
107 | 108 | will always be ahead of few entries |
108 | 109 | */ |
| 110 | + $conditions = array(); |
| 111 | + if ( count( $wgJobTypesExcludedFromDefaultQueue ) != 0 ) { |
| 112 | + foreach ( $wgJobTypesExcludedFromDefaultQueue as $cmdType ) { |
| 113 | + $conditions[] = "job_cmd != " . $dbr->addQuotes( $cmdType ); |
| 114 | + } |
| 115 | + } |
| 116 | + $offset = intval( $offset ); |
| 117 | + $row = $dbr->selectRow( 'job', '*', array_merge( $conditions, array( "job_id >= $offset" ) ) , __METHOD__, |
| 118 | + array( 'ORDER BY' => 'job_id', 'LIMIT' => 1 ) |
| 119 | + ); |
109 | 120 | |
110 | | - $row = $dbr->selectRow( 'job', '*', "job_id >= ${offset}", __METHOD__, |
111 | | - array( 'ORDER BY' => 'job_id', 'LIMIT' => 1 ) ); |
112 | | - |
113 | 121 | // Refetching without offset is needed as some of job IDs could have had delayed commits |
114 | 122 | // and have lower IDs than jobs already executed, blame concurrency :) |
115 | 123 | // |
116 | 124 | if ( $row === false ) { |
117 | 125 | if ( $offset != 0 ) { |
118 | | - $row = $dbr->selectRow( 'job', '*', '', __METHOD__, |
| 126 | + $row = $dbr->selectRow( 'job', '*', $conditions, __METHOD__, |
119 | 127 | array( 'ORDER BY' => 'job_id', 'LIMIT' => 1 ) ); |
120 | 128 | } |
121 | 129 | |