MediaWiki
1.32.0
|
Class to handle enqueueing of background jobs. More...
Public Member Functions | |
ack (Job $job) | |
Acknowledge that a job was completed. More... | |
deduplicateRootJob (Job $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 queus 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 $blacklist=[]) | |
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 | pushLazyJobs () |
Push all jobs buffered via lazyPush() into their respective queues. More... | |
static | singleton ( $wiki=false) |
Public Attributes | |
const | CACHE_VERSION = 1 |
const | PROC_CACHE_TTL = 15 |
const | TYPE_ANY = 2 |
const | TYPE_DEFAULT = 1 |
const | USE_CACHE = 1 |
Protected Member Functions | |
__construct ( $wiki, $readOnlyReason) | |
getCoalescedQueues () | |
Protected Attributes | |
ProcessCacheLRU | $cache |
array | $coalescedQueues |
Map of (bucket => (queue => JobQueue, types => list of types) More... | |
bool | $invalidWiki = false |
Whether the wiki is not recognized in configuration. More... | |
string bool | $readOnlyReason |
Read only rationale (or false if r/w) More... | |
string | $wiki |
Wiki ID. More... | |
Static Protected Attributes | |
static JobQueueGroup[] | $instances = [] |
Private Member Functions | |
assertValidJobs (array $jobs) | |
getCachedConfigVar ( $name) | |
Class to handle enqueueing of background jobs.
Definition at line 29 of file JobQueueGroup.php.
|
protected |
string | $wiki | Wiki ID |
string | bool | $readOnlyReason | Read-only reason or false |
Definition at line 59 of file JobQueueGroup.php.
References $readOnlyReason, $wiki, cache, and wiki.
JobQueueGroup::ack | ( | Job | $job | ) |
Acknowledge that a job was completed.
Job | $job |
Definition at line 271 of file JobQueueGroup.php.
References $job, and Job\getType().
|
private |
array | $jobs |
InvalidArgumentException |
Definition at line 450 of file JobQueueGroup.php.
Referenced by lazyPush(), and push().
JobQueueGroup::deduplicateRootJob | ( | Job | $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.
Job | $job |
Definition at line 282 of file JobQueueGroup.php.
References $job, and Job\getType().
|
static |
Destroy the singleton instances.
Definition at line 91 of file JobQueueGroup.php.
Referenced by ForkController\prepareEnvironment(), MediaWikiTestCase\resetNonServiceCaches(), CategoryMembershipChangeJobTest\runJobs(), ClearUserWatchlistJobTest\setUp(), ApiDeleteTest\testBatchedDelete(), WikiPageDbTestBase\testDoDeleteArticle(), WikiPageDbTestBase\testDoDeleteUpdates(), and TemplateCategoriesTest\testTemplateCategories().
JobQueueGroup::get | ( | $type | ) |
Get the job queue object for a given queue type.
string | $type |
Definition at line 101 of file JobQueueGroup.php.
References $readOnlyReason, $type, $wgJobTypeConf, $wiki, JobQueue\factory(), and JobQueueAggregator\singleton().
|
private |
string | $name |
Definition at line 424 of file JobQueueGroup.php.
References $cache, $GLOBALS, $name, $value, $wgConf, $wiki, ObjectCache\getMainWANInstance(), IExpiringStore\TTL_PROC_LONG, use, wfWikiID(), and wiki.
Referenced by getQueueTypes().
|
protected |
Definition at line 393 of file JobQueueGroup.php.
References $coalescedQueues, $queue, $type, $wgJobTypeConf, as, JobQueue\factory(), getQueueTypes(), and wiki.
Referenced by getQueueSizes(), and getQueuesWithJobs().
JobQueueGroup::getDefaultQueueTypes | ( | ) |
Get the list of default queue types.
Definition at line 316 of file JobQueueGroup.php.
References $wgJobTypesExcludedFromDefaultQueue, and getQueueTypes().
Referenced by pop(), and queuesHaveJobs().
JobQueueGroup::getQueueSizes | ( | ) |
Get the size of the queus for a list of job types.
Definition at line 374 of file JobQueueGroup.php.
References $type, as, getCoalescedQueues(), and getQueueTypes().
JobQueueGroup::getQueuesWithJobs | ( | ) |
Get the list of job types that have non-empty queues.
Definition at line 351 of file JobQueueGroup.php.
References $type, as, getCoalescedQueues(), and getQueueTypes().
Referenced by pop(), and queuesHaveJobs().
JobQueueGroup::getQueueTypes | ( | ) |
Get the list of queue types.
Definition at line 307 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.
Note that pushLazyJobs() is registered as a deferred update just before DeferredUpdates::doUpdates() in MediaWiki and JobRunner classes in order to be executed as the very last deferred update (T100085, T154425).
IJobSpecification | IJobSpecification[] | $jobs | A single Job or a list of Jobs |
Definition at line 187 of file JobQueueGroup.php.
References DeferredUpdates\addUpdate(), assertValidJobs(), push(), and wiki.
JobQueueGroup::pop | ( | $qtype = self::TYPE_DEFAULT , |
|
$flags = 0 , |
|||
array | $blacklist = [] |
||
) |
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 | $blacklist | List of job types to ignore |
Definition at line 228 of file JobQueueGroup.php.
References $job, $type, as, cache, getDefaultQueueTypes(), and getQueuesWithJobs().
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 128 of file JobQueueGroup.php.
References $cache, $e, $job, $type, $wgJobTypesExcludedFromDefaultQueue, as, assertValidJobs(), cache, captcha-old\count, ObjectCache\getLocalClusterInstance(), MWExceptionHandler\logException(), and ProcessCacheLRU\set().
Referenced by lazyPush().
|
static |
Push all jobs buffered via lazyPush() into their respective queues.
Definition at line 213 of file JobQueueGroup.php.
References wfDeprecated().
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 329 of file JobQueueGroup.php.
References $cache, $type, $value, captcha-old\count, ProcessCacheLRU\get(), getDefaultQueueTypes(), ObjectCache\getLocalClusterInstance(), getQueuesWithJobs(), and wiki.
|
static |
bool | string | $wiki | Wiki ID |
Definition at line 69 of file JobQueueGroup.php.
References $wgLocalDatabases, $wiki, false, wfConfiguredReadOnlyReason(), and wfWikiID().
Referenced by MediaWikiTestCase\addCoreDBData(), WatchedItemStore\clearUserWatchedItemsUsingJobQueue(), WikiPage\doDeleteArticleBatched(), SpecialReplaceText\doSpecialReplaceText(), HTMLCacheUpdate\doUpdate(), JobQueueEnqueueUpdate\doUpdate(), CdnCacheUpdate\doUpdate(), DeferredUpdates\enqueueUpdates(), ManageJobs\execute(), CopyJobQueue\execute(), ShowJobs\execute(), JobQueueAggregator\findPendingWikiQueues(), DoubleRedirectJob\fixRedirects(), ApiUpload\getChunkResult(), ApiMain\getMaxLag(), UserGroupMembership\insert(), CreatePdfThumbnailsJob\insertJobs(), SiteStats\jobs(), WikiPage\newDerivedDataUpdater(), EmailNotification\notifyOnPageChange(), ApiUpload\performUpload(), LocalFile\prerenderThumbnails(), FixDoubleRedirects\queueJobs(), LinksUpdate\queueRecursiveJobs(), LinksUpdate\queueRecursiveJobsForTable(), RenameuserSQL\rename(), MediaWikiTestCase\resetNonServiceCaches(), ClearUserWatchlistJob\run(), NullJob\run(), HTMLCacheUpdateJob\run(), RefreshLinksJob\run(), EnqueueJob\run(), JobRunner\run(), LinksUpdateTest\runAllRelatedJobs(), DeferredUpdates\runUpdate(), RecentChange\save(), MediaWikiTestCase\teardownTestDB(), UploadFromUrlTest\testClearQueue(), SiteStatsTest\testJobsCountGetCached(), ClearUserWatchlistJobTest\testRun(), UploadFromUrlTest\testSyncDownload(), MediaWiki\triggerAsyncJobs(), and WikiPage\triggerOpportunisticLinksUpdate().
JobQueueGroup::waitForBackups | ( | ) |
Wait for any replica DBs or backup queue servers to catch up.
This does nothing for certain queue classes.
Definition at line 293 of file JobQueueGroup.php.
References $type, $wgJobTypeConf, and as.
|
protected |
Definition at line 34 of file JobQueueGroup.php.
Referenced by getCachedConfigVar(), push(), and queuesHaveJobs().
|
protected |
Map of (bucket => (queue => JobQueue, types => list of types)
Definition at line 44 of file JobQueueGroup.php.
Referenced by getCoalescedQueues().
|
staticprotected |
Definition at line 31 of file JobQueueGroup.php.
|
protected |
Whether the wiki is not recognized in configuration.
Definition at line 41 of file JobQueueGroup.php.
|
protected |
Read only rationale (or false if r/w)
Definition at line 39 of file JobQueueGroup.php.
Referenced by __construct(), and get().
|
protected |
Wiki ID.
Definition at line 37 of file JobQueueGroup.php.
Referenced by __construct(), get(), getCachedConfigVar(), and singleton().
const JobQueueGroup::CACHE_VERSION = 1 |
Definition at line 53 of file JobQueueGroup.php.
const JobQueueGroup::PROC_CACHE_TTL = 15 |
Definition at line 51 of file JobQueueGroup.php.
const JobQueueGroup::TYPE_ANY = 2 |
Definition at line 47 of file JobQueueGroup.php.
const JobQueueGroup::TYPE_DEFAULT = 1 |
Definition at line 46 of file JobQueueGroup.php.
Referenced by JobRunner\run(), and MediaWiki\triggerAsyncJobs().
const JobQueueGroup::USE_CACHE = 1 |
Definition at line 49 of file JobQueueGroup.php.
Referenced by JobRunner\run().