/** @var array Map of (bucket => (queue => JobQueue, types => list of types) */
protected $coalescedQueues;
- /** @var Job[] */
- protected $bufferedJobs = [];
-
const TYPE_DEFAULT = 1; // integer; jobs popped by default
const TYPE_ANY = 2; // integer; any job
global $wgJobTypeConf;
$conf = [ 'wiki' => $this->wiki, 'type' => $type ];
- if ( isset( $wgJobTypeConf[$type] ) ) {
- $conf = $conf + $wgJobTypeConf[$type];
- } else {
- $conf = $conf + $wgJobTypeConf['default'];
- }
+ $conf += $wgJobTypeConf[$type] ?? $wgJobTypeConf['default'];
$conf['aggregator'] = JobQueueAggregator::singleton();
if ( !isset( $conf['readOnlyReason'] ) ) {
$conf['readOnlyReason'] = $this->readOnlyReason;
// Throw errors now instead of on push(), when other jobs may be buffered
$this->assertValidJobs( $jobs );
- $this->bufferedJobs = array_merge( $this->bufferedJobs, $jobs );
+ DeferredUpdates::addUpdate( new JobQueueEnqueueUpdate( $this->wiki, $jobs ) );
}
/**
*
* @return void
* @since 1.26
+ * @deprecated Since 1.33 Not needed anymore
*/
public static function pushLazyJobs() {
- foreach ( self::$instances as $group ) {
- try {
- $group->push( $group->bufferedJobs );
- $group->bufferedJobs = [];
- } catch ( Exception $e ) {
- // Get in as many jobs as possible and let other post-send updates happen
- MWExceptionHandler::logException( $e );
- }
- }
+ wfDeprecated( __METHOD__, '1.33' );
}
/**
}
}
}
-
- function __destruct() {
- $n = count( $this->bufferedJobs );
- if ( $n > 0 ) {
- $type = implode( ', ', array_unique( array_map( 'get_class', $this->bufferedJobs ) ) );
- trigger_error( __METHOD__ . ": $n buffered job(s) of type(s) $type never inserted." );
- }
- }
}