|
MediaWiki master
|
Handle enqueueing of background jobs. More...

Public Member Functions | |
| __construct ( $domain, ReadOnlyMode $readOnlyMode, ?array $localJobClasses, array $jobTypeConfiguration, array $jobTypesExcludedFromDefaultQueue, StatsFactory $statsFactory, WANObjectCache $wanCache, GlobalIdGenerator $globalIdGenerator) | |
| ack (RunnableJob $job) | |
| Acknowledge that a job was completed. | |
| get ( $type) | |
| Get the job queue object for a given queue type. | |
| getDefaultQueueTypes () | |
| Get the list of default queue types. | |
| getQueueSizes () | |
| Get the size of the queues for a list of job types. | |
| getQueuesWithJobs () | |
| Get the list of job types that have non-empty queues. | |
| getQueueTypes () | |
| Get the list of queue types. | |
| lazyPush ( $jobs) | |
| Buffer jobs for insertion via push() or call it now if in CLI mode. | |
| pop ( $qtype=self::TYPE_DEFAULT, $flags=0, array $ignored=[]) | |
| Pop one job off a job queue. | |
| push ( $jobs) | |
| Insert jobs into the respective queues of which they belong. | |
| queuesHaveJobs ( $type=self::TYPE_ANY) | |
| Check if there are any queues with jobs (this is cached) | |
Public Attributes | |
| const | TYPE_DEFAULT = 1 |
| const | USE_CACHE = 1 |
Protected Member Functions | |
| getCoalescedQueues () | |
Protected Attributes | |
| MapCacheLRU | $cache |
| array | $coalescedQueues |
| Map of (bucket => (queue => JobQueue, types => list of types) | |
| string | $domain |
| Wiki domain ID. | |
| ReadOnlyMode | $readOnlyMode |
| Read only mode. | |
Handle enqueueing of background jobs.
Definition at line 31 of file JobQueueGroup.php.
| MediaWiki\JobQueue\JobQueueGroup::__construct | ( | $domain, | |
| ReadOnlyMode | $readOnlyMode, | ||
| ?array | $localJobClasses, | ||
| array | $jobTypeConfiguration, | ||
| array | $jobTypesExcludedFromDefaultQueue, | ||
| StatsFactory | $statsFactory, | ||
| WANObjectCache | $wanCache, | ||
| GlobalIdGenerator | $globalIdGenerator ) |
| string | $domain | Wiki domain ID |
| ReadOnlyMode | $readOnlyMode | Read-only mode |
| array | null | $localJobClasses | |
| array | $jobTypeConfiguration | |
| array | $jobTypesExcludedFromDefaultQueue | |
| StatsFactory | $statsFactory | |
| WANObjectCache | $wanCache | |
| GlobalIdGenerator | $globalIdGenerator |
Definition at line 74 of file JobQueueGroup.php.
References MediaWiki\JobQueue\JobQueueGroup\$domain, and MediaWiki\JobQueue\JobQueueGroup\$readOnlyMode.
| MediaWiki\JobQueue\JobQueueGroup::ack | ( | RunnableJob | $job | ) |
Acknowledge that a job was completed.
| RunnableJob | $job |
Definition at line 262 of file JobQueueGroup.php.
References $job, MediaWiki\JobQueue\JobQueueGroup\ack(), and MediaWiki\JobQueue\IJobSpecification\getType().
Referenced by MediaWiki\JobQueue\JobQueueGroup\ack().
| MediaWiki\JobQueue\JobQueueGroup::get | ( | $type | ) |
Get the job queue object for a given queue type.
| string | $type |
Definition at line 101 of file JobQueueGroup.php.
References MediaWiki\JobQueue\JobQueueGroup\$domain, and MediaWiki\JobQueue\JobQueue\factory().
Referenced by MediaWiki\Api\ApiUpload\__construct().
|
protected |
Definition at line 373 of file JobQueueGroup.php.
References MediaWiki\JobQueue\JobQueueGroup\$coalescedQueues, MediaWiki\JobQueue\JobQueueGroup\$domain, MediaWiki\JobQueue\JobQueue\factory(), and MediaWiki\JobQueue\JobQueueGroup\getQueueTypes().
Referenced by MediaWiki\JobQueue\JobQueueGroup\getQueueSizes(), and MediaWiki\JobQueue\JobQueueGroup\getQueuesWithJobs().
| MediaWiki\JobQueue\JobQueueGroup::getDefaultQueueTypes | ( | ) |
Get the list of default queue types.
Definition at line 287 of file JobQueueGroup.php.
References MediaWiki\JobQueue\JobQueueGroup\getQueueTypes().
Referenced by MediaWiki\JobQueue\JobQueueGroup\pop(), and MediaWiki\JobQueue\JobQueueGroup\queuesHaveJobs().
| MediaWiki\JobQueue\JobQueueGroup::getQueueSizes | ( | ) |
Get the size of the queues for a list of job types.
Definition at line 351 of file JobQueueGroup.php.
References MediaWiki\JobQueue\JobQueueGroup\getCoalescedQueues(), and MediaWiki\JobQueue\JobQueueGroup\getQueueTypes().
| MediaWiki\JobQueue\JobQueueGroup::getQueuesWithJobs | ( | ) |
Get the list of job types that have non-empty queues.
Definition at line 324 of file JobQueueGroup.php.
References MediaWiki\JobQueue\JobQueueGroup\getCoalescedQueues(), and MediaWiki\JobQueue\JobQueueGroup\getQueueTypes().
Referenced by MediaWiki\JobQueue\JobQueueGroup\pop(), and MediaWiki\JobQueue\JobQueueGroup\queuesHaveJobs().
| MediaWiki\JobQueue\JobQueueGroup::getQueueTypes | ( | ) |
Get the list of queue types.
Definition at line 273 of file JobQueueGroup.php.
Referenced by MediaWiki\JobQueue\JobQueueGroup\getCoalescedQueues(), MediaWiki\JobQueue\JobQueueGroup\getDefaultQueueTypes(), MediaWiki\JobQueue\JobQueueGroup\getQueueSizes(), and MediaWiki\JobQueue\JobQueueGroup\getQueuesWithJobs().
| MediaWiki\JobQueue\JobQueueGroup::lazyPush | ( | $jobs | ) |
Buffer jobs for insertion via push() or call it now if in CLI mode.
| IJobSpecification | IJobSpecification[] | $jobs | A single Job or a list of Jobs |
Definition at line 182 of file JobQueueGroup.php.
References MediaWiki\JobQueue\JobQueueGroup\push().
| MediaWiki\JobQueue\JobQueueGroup::pop | ( | $qtype = self::TYPE_DEFAULT, | |
| $flags = 0, | |||
| array | $ignored = [] ) |
Pop one job off a job queue.
This pops a job off a queue as specified by $wgJobTypeConf and updates the aggregate job queue information cache as needed.
| int | string | $qtype | JobQueueGroup::TYPE_* constant or job type string |
| int | $flags | Bitfield of JobQueueGroup::USE_* constants |
| array | $ignored | List of job types to ignore |
| JobQueueError |
Definition at line 210 of file JobQueueGroup.php.
References $job, MediaWiki\JobQueue\JobQueueGroup\getDefaultQueueTypes(), MediaWiki\JobQueue\JobQueueGroup\getQueuesWithJobs(), and MediaWiki\JobQueue\JobQueueGroup\pop().
Referenced by MediaWiki\JobQueue\JobQueueGroup\pop().
| MediaWiki\JobQueue\JobQueueGroup::push | ( | $jobs | ) |
Insert jobs into the respective queues of which they belong.
This inserts the jobs into the queue specified by $wgJobTypeConf and updates the aggregate job queue information cache as needed.
| IJobSpecification | IJobSpecification[] | $jobs | A single Job or a list of Jobs |
Definition at line 124 of file JobQueueGroup.php.
References MediaWiki\JobQueue\JobQueueGroup\$cache, $job, MediaWiki\MediaWikiServices\getInstance(), MediaWiki\JobQueue\JobQueueGroup\push(), and Wikimedia\MapCacheLRU\MapCacheLRU\set().
Referenced by MediaWiki\JobQueue\JobQueueGroup\lazyPush(), and MediaWiki\JobQueue\JobQueueGroup\push().
| MediaWiki\JobQueue\JobQueueGroup::queuesHaveJobs | ( | $type = self::TYPE_ANY | ) |
Check if there are any queues with jobs (this is cached)
| int | $type | JobQueueGroup::TYPE_* constant |
Definition at line 300 of file JobQueueGroup.php.
References MediaWiki\JobQueue\JobQueueGroup\$cache, Wikimedia\MapCacheLRU\MapCacheLRU\get(), MediaWiki\JobQueue\JobQueueGroup\getDefaultQueueTypes(), MediaWiki\MediaWikiServices\getInstance(), and MediaWiki\JobQueue\JobQueueGroup\getQueuesWithJobs().
|
protected |
Definition at line 33 of file JobQueueGroup.php.
Referenced by MediaWiki\JobQueue\JobQueueGroup\push(), and MediaWiki\JobQueue\JobQueueGroup\queuesHaveJobs().
|
protected |
Map of (bucket => (queue => JobQueue, types => list of types)
Definition at line 53 of file JobQueueGroup.php.
Referenced by MediaWiki\JobQueue\JobQueueGroup\getCoalescedQueues().
|
protected |
Wiki domain ID.
Definition at line 36 of file JobQueueGroup.php.
Referenced by MediaWiki\JobQueue\JobQueueGroup\__construct(), MediaWiki\JobQueue\JobQueueGroup\get(), and MediaWiki\JobQueue\JobQueueGroup\getCoalescedQueues().
|
protected |
Read only mode.
Definition at line 38 of file JobQueueGroup.php.
Referenced by MediaWiki\JobQueue\JobQueueGroup\__construct().
| const MediaWiki\JobQueue\JobQueueGroup::TYPE_DEFAULT = 1 |
Definition at line 55 of file JobQueueGroup.php.
Referenced by MediaWiki\JobQueue\JobRunner\run().
| const MediaWiki\JobQueue\JobQueueGroup::USE_CACHE = 1 |
Definition at line 58 of file JobQueueGroup.php.
Referenced by MediaWiki\JobQueue\JobRunner\run().