MediaWiki
master
|
Class to handle enqueueing of background jobs. More...
Public Member Functions | |
ack (RunnableJob $job) | |
Acknowledge that a job was completed. More... | |
deduplicateRootJob (RunnableJob $job) | |
Register the "root job" of a given job into the queue for de-duplication. More... | |
get ( $type) | |
Get the job queue object for a given queue type. More... | |
getDefaultQueueTypes () | |
Get the list of default queue types. More... | |
getQueueSizes () | |
Get the size of the queues for a list of job types. More... | |
getQueuesWithJobs () | |
Get the list of job types that have non-empty queues. More... | |
getQueueTypes () | |
Get the list of queue types. More... | |
lazyPush ( $jobs) | |
Buffer jobs for insertion via push() or call it now if in CLI mode. More... | |
pop ( $qtype=self::TYPE_DEFAULT, $flags=0, array $ignored=[]) | |
Pop a job off one of the job queues. More... | |
push ( $jobs) | |
Insert jobs into the respective queues of which they belong. More... | |
queuesHaveJobs ( $type=self::TYPE_ANY) | |
Check if there are any queues with jobs (this is cached) More... | |
waitForBackups () | |
Wait for any replica DBs or backup queue servers to catch up. More... | |
Static Public Member Functions | |
static | destroySingletons () |
Destroy the singleton instances. More... | |
static | singleton ( $domain=false) |
Public Attributes | |
const | TYPE_DEFAULT = 1 |
const | USE_CACHE = 1 |
Protected Member Functions | |
__construct ( $domain, $readOnlyReason) | |
getCoalescedQueues () | |
Protected Attributes | |
MapCacheLRU | $cache |
array | $coalescedQueues |
Map of (bucket => (queue => JobQueue, types => list of types) More... | |
string | $domain |
Wiki domain ID. More... | |
bool | $invalidDomain = false |
Whether the wiki is not recognized in configuration. More... | |
string bool | $readOnlyReason |
Read only rationale (or false if r/w) More... | |
Static Protected Attributes | |
static JobQueueGroup[] | $instances = [] |
Private Member Functions | |
assertValidJobs (array $jobs) | |
factoryJobQueue (array $conf) | |
getCachedConfigVar ( $name) | |
Private Attributes | |
const | CACHE_VERSION = 1 |
const | PROC_CACHE_TTL = 15 |
const | TYPE_ANY = 2 |
Class to handle enqueueing of background jobs.
Definition at line 30 of file JobQueueGroup.php.
|
protected |
string | $domain | Wiki domain ID |
string | bool | $readOnlyReason | Read-only reason or false |
Definition at line 60 of file JobQueueGroup.php.
References $domain, and $readOnlyReason.
JobQueueGroup::ack | ( | RunnableJob | $job | ) |
Acknowledge that a job was completed.
RunnableJob | $job |
Definition at line 289 of file JobQueueGroup.php.
References $job, and IJobSpecification\getType().
|
private |
array | $jobs |
InvalidArgumentException |
Definition at line 473 of file JobQueueGroup.php.
References $job.
Referenced by lazyPush(), and push().
JobQueueGroup::deduplicateRootJob | ( | RunnableJob | $job | ) |
Register the "root job" of a given job into the queue for de-duplication.
This should only be called right after all the new jobs have been inserted.
RunnableJob | $job |
Definition at line 300 of file JobQueueGroup.php.
References $job, and IJobSpecification\getType().
|
static |
Destroy the singleton instances.
Definition at line 101 of file JobQueueGroup.php.
Referenced by ForkController\prepareEnvironment().
|
private |
array | $conf |
JobQueueError |
Definition at line 132 of file JobQueueGroup.php.
References JobQueue\factory().
Referenced by get(), and getCoalescedQueues().
JobQueueGroup::get | ( | $type | ) |
Get the job queue object for a given queue type.
string | $type |
Definition at line 111 of file JobQueueGroup.php.
References $domain, $readOnlyReason, $type, $wgJobTypeConf, and factoryJobQueue().
|
private |
string | $name |
Definition at line 447 of file JobQueueGroup.php.
References $cache, $wgConf, WikiMap\getWikiIdFromDbDomain(), MapCacheLRU\getWithSetCallback(), and WikiMap\isCurrentWikiDbDomain().
Referenced by getQueueTypes().
|
protected |
Definition at line 416 of file JobQueueGroup.php.
References $coalescedQueues, $queue, $type, $wgJobTypeConf, factoryJobQueue(), and getQueueTypes().
Referenced by getQueueSizes(), and getQueuesWithJobs().
JobQueueGroup::getDefaultQueueTypes | ( | ) |
Get the list of default queue types.
Definition at line 334 of file JobQueueGroup.php.
References $wgJobTypesExcludedFromDefaultQueue, and getQueueTypes().
Referenced by pop(), and queuesHaveJobs().
JobQueueGroup::getQueueSizes | ( | ) |
Get the size of the queues for a list of job types.
Definition at line 394 of file JobQueueGroup.php.
References $queue, $type, getCoalescedQueues(), and getQueueTypes().
JobQueueGroup::getQueuesWithJobs | ( | ) |
Get the list of job types that have non-empty queues.
Definition at line 369 of file JobQueueGroup.php.
References $queue, $type, getCoalescedQueues(), and getQueueTypes().
Referenced by pop(), and queuesHaveJobs().
JobQueueGroup::getQueueTypes | ( | ) |
Get the list of queue types.
Definition at line 325 of file JobQueueGroup.php.
References getCachedConfigVar().
Referenced by getCoalescedQueues(), getDefaultQueueTypes(), getQueueSizes(), and getQueuesWithJobs().
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 206 of file JobQueueGroup.php.
References DeferredUpdates\addUpdate(), assertValidJobs(), and push().
JobQueueGroup::pop | ( | $qtype = self::TYPE_DEFAULT , |
|
$flags = 0 , |
|||
array | $ignored = [] |
||
) |
Pop a job off one of the job queues.
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 |
Definition at line 236 of file JobQueueGroup.php.
References $job, $type, $wgJobClasses, getDefaultQueueTypes(), getQueuesWithJobs(), and WikiMap\isCurrentWikiDbDomain().
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 |
InvalidArgumentException |
Definition at line 151 of file JobQueueGroup.php.
References $cache, $job, $type, $wgJobTypesExcludedFromDefaultQueue, assertValidJobs(), ObjectCache\getLocalClusterInstance(), MWExceptionHandler\logException(), and MapCacheLRU\set().
Referenced by lazyPush().
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 347 of file JobQueueGroup.php.
References $cache, $type, MapCacheLRU\get(), getDefaultQueueTypes(), ObjectCache\getLocalClusterInstance(), and getQueuesWithJobs().
|
static |
bool | string | $domain | Wiki domain ID |
Definition at line 70 of file JobQueueGroup.php.
References $domain, $wgLocalDatabases, WikiMap\getCurrentWikiDbDomain(), WikiMap\getWikiIdFromDbDomain(), and WikiMap\isCurrentWikiDbDomain().
Referenced by JobRunner\__construct(), MediaWiki\User\UserGroupManager\addUserToGroup(), WikiPage\doDeleteArticleBatched(), WikiFilePage\doPurge(), CdnCacheUpdate\doUpdate(), HTMLCacheUpdate\doUpdate(), JobQueueEnqueueUpdate\doUpdate(), CopyJobQueue\execute(), ManageJobs\execute(), ShowJobs\execute(), DoubleRedirectJob\fixRedirects(), ApiUpload\getChunkResult(), ApiMain\getMaxLag(), LinksUpdate\invalidateProperties(), DeferredUpdates\jobify(), SiteStats\jobs(), WikiPage\newDerivedDataUpdater(), EmailNotification\notifyOnPageChange(), WikiPage\onArticleCreate(), WikiPage\onArticleDelete(), WikiPage\onArticleEdit(), ApiUpload\performUpload(), LocalFile\prerenderThumbnails(), File\purgeEverything(), FixDoubleRedirects\queueJobs(), LinksUpdate\queueRecursiveJobs(), LinksUpdate\queueRecursiveJobsForTable(), LocalFile\recordUpload3(), ClearUserWatchlistJob\run(), EnqueueJob\run(), HTMLCacheUpdateJob\run(), NullJob\run(), RefreshLinksJob\run(), WatchlistExpiryJob\run(), DeferredUpdates\run(), RecentChange\save(), Title\touchLinks(), MediaWiki\triggerAsyncJobs(), WikiPage\triggerOpportunisticLinksUpdate(), DeferredUpdates\tryOpportunisticExecute(), and PageArchive\undeleteRevisions().
JobQueueGroup::waitForBackups | ( | ) |
Wait for any replica DBs or backup queue servers to catch up.
This does nothing for certain queue classes.
Definition at line 311 of file JobQueueGroup.php.
References $type, and $wgJobTypeConf.
|
protected |
Definition at line 35 of file JobQueueGroup.php.
Referenced by getCachedConfigVar(), push(), and queuesHaveJobs().
|
protected |
Map of (bucket => (queue => JobQueue, types => list of types)
Definition at line 45 of file JobQueueGroup.php.
Referenced by getCoalescedQueues().
|
protected |
Wiki domain ID.
Definition at line 38 of file JobQueueGroup.php.
Referenced by __construct(), get(), and singleton().
|
staticprotected |
Definition at line 32 of file JobQueueGroup.php.
|
protected |
Whether the wiki is not recognized in configuration.
Definition at line 42 of file JobQueueGroup.php.
|
protected |
Read only rationale (or false if r/w)
Definition at line 40 of file JobQueueGroup.php.
Referenced by __construct(), and get().
|
private |
Definition at line 54 of file JobQueueGroup.php.
|
private |
Definition at line 52 of file JobQueueGroup.php.
|
private |
Definition at line 48 of file JobQueueGroup.php.
const JobQueueGroup::TYPE_DEFAULT = 1 |
Definition at line 47 of file JobQueueGroup.php.
Referenced by JobRunner\run(), and MediaWiki\triggerAsyncJobs().
const JobQueueGroup::USE_CACHE = 1 |
Definition at line 50 of file JobQueueGroup.php.
Referenced by JobRunner\run().