protected function __construct( $wiki, $readOnlyReason ) {
$this->wiki = $wiki;
$this->readOnlyReason = $readOnlyReason;
- $this->cache = new ProcessCacheLRU( 10 );
+ $this->cache = new MapCacheLRU( 10 );
}
/**
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 ( $this->readOnlyReason !== false ) {
+ if ( !isset( $conf['readOnlyReason'] ) ) {
$conf['readOnlyReason'] = $this->readOnlyReason;
}
$this->get( $type )->push( $jobs );
}
- if ( $this->cache->has( 'queues-ready', 'list' ) ) {
- $list = $this->cache->get( 'queues-ready', 'list' );
+ if ( $this->cache->hasField( 'queues-ready', 'list' ) ) {
+ $list = $this->cache->getField( 'queues-ready', 'list' );
if ( count( array_diff( array_keys( $jobsByType ), $list ) ) ) {
$this->cache->clear( 'queues-ready' );
}
}
} else { // any job in the "default" jobs types
if ( $flags & self::USE_CACHE ) {
- if ( !$this->cache->has( 'queues-ready', 'list', self::PROC_CACHE_TTL ) ) {
- $this->cache->set( 'queues-ready', 'list', $this->getQueuesWithJobs() );
+ if ( !$this->cache->hasField( 'queues-ready', 'list', self::PROC_CACHE_TTL ) ) {
+ $this->cache->setField( 'queues-ready', 'list', $this->getQueuesWithJobs() );
}
- $types = $this->cache->get( 'queues-ready', 'list' );
+ $types = $this->cache->getField( 'queues-ready', 'list' );
} else {
$types = $this->getQueuesWithJobs();
}