60 $this->
type = $params[
'type'];
61 $this->claimTTL =
$params[
'claimTTL'] ?? 0;
62 $this->maxTries =
$params[
'maxTries'] ?? 3;
64 $this->order =
$params[
'order'];
69 throw new JobQueueError( __CLASS__ .
" does not support '{$this->order}' order." );
71 $this->readOnlyReason =
$params[
'readOnlyReason'] ??
false;
109 throw new JobQueueError(
"Invalid job queue class '$class'." );
112 if ( !( $obj instanceof
self ) ) {
113 throw new JobQueueError(
"Class '$class' is not a " . __CLASS__ .
" class." );
131 return WikiMap::getWikiIdFromDbDomain( $this->domain );
310 final public function push( $jobs, $flags = 0 ) {
328 if ( $jobs === [] ) {
332 foreach ( $jobs as
$job ) {
333 if (
$job->getType() !== $this->type ) {
335 "Got '{$job->getType()}' job; expected a '{$this->type}' job." );
336 }
elseif (
$job->getReleaseTimestamp() && !$this->supportsDelayedJobs() ) {
338 "Got delayed '{$job->getType()}' job; delays are not supported." );
344 foreach ( $jobs as
$job ) {
345 if (
$job->isRootJob() ) {
366 final public function pop() {
377 }
catch ( Exception
$e ) {
388 abstract protected function doPop();
402 if ( $job->
getType() !== $this->type ) {
403 throw new JobQueueError(
"Got '{$job->getType()}' job; expected '{$this->type}'." );
406 $this->
doAck( $job );
448 if ( $job->
getType() !== $this->type ) {
449 throw new JobQueueError(
"Got '{$job->getType()}' job; expected '{$this->type}'." );
462 if ( !
$job->hasRootJobParams() ) {
463 throw new JobQueueError(
"Cannot register root job; missing parameters." );
473 $timestamp = $this->dupCache->get( $key );
474 if ( $timestamp && $timestamp >=
$params[
'rootJobTimestamp'] ) {
479 return $this->dupCache->set( $key,
$params[
'rootJobTimestamp'], self::ROOTJOB_TTL );
490 if (
$job->getType() !== $this->type ) {
491 throw new JobQueueError(
"Got '{$job->getType()}' job; expected '{$this->type}'." );
504 if ( !
$job->hasRootJobParams() ) {
511 $timestamp = $this->dupCache->get( $key );
514 return ( $timestamp && $timestamp >
$params[
'rootJobTimestamp'] );
522 return $this->dupCache->makeGlobalKey(
538 final public function delete() {
549 throw new JobQueueError(
"This method is not implemented." );
693 if ( $this->readOnlyReason !==
false ) {
707 $this->stats->updateCount(
"jobqueue.{$key}.all", $delta );
708 $this->stats->updateCount(
"jobqueue.{$key}.{$type}", $delta );
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
Class representing a cache/ephemeral data store.
static newFromJob(Job $job)
Get a duplicate no-op version of a job.
A BagOStuff object with no objects in it.
Class to handle enqueueing and running of background jobs.
isEmpty()
Quickly check if the queue has no available (unacquired, non-delayed) jobs.
incrStats( $key, $type, $delta=1)
Call wfIncrStats() for the queue overall and for the queue type.
string $order
Job priority for pop()
__construct(array $params)
getAbandonedCount()
Get the number of acquired jobs that can no longer be attempted.
waitForBackups()
Wait for any replica DBs or backup servers to catch up.
isRootJobOldDuplicate(Job $job)
Check if the "root" job of a given job has been superseded by a newer one.
push( $jobs, $flags=0)
Push one or more jobs into the queue.
pop()
Pop a job off of the queue.
int $claimTTL
Time to live in seconds.
doDeduplicateRootJob(IJobSpecification $job)
getCoalesceLocationInternal()
Do not use this function outside of JobQueue/JobQueueGroup.
batchPush(array $jobs, $flags=0)
Push a batch of jobs into the queue.
doGetSiblingQueueSizes(array $types)
supportsDelayedJobs()
Find out if delayed jobs are supported for configuration validation.
getSiblingQueueSizes(array $types)
Check the size of each of the given queues.
StatsdDataFactoryInterface $stats
int $maxTries
Maximum number of times to try a job.
getAllQueuedJobs()
Get an iterator to traverse over all available jobs in this queue.
static factory(array $params)
Get a job queue object of the specified type.
getAllAbandonedJobs()
Get an iterator to traverse over all abandoned jobs in this queue.
doBatchPush(array $jobs, $flags)
ack(Job $job)
Acknowledge that a job was completed.
getAllAcquiredJobs()
Get an iterator to traverse over all claimed jobs in this queue.
string bool $readOnlyReason
Read only rationale (or false if r/w)
doGetSiblingQueuesWithJobs(array $types)
deduplicateRootJob(IJobSpecification $job)
Register the "root job" of a given job into the queue for de-duplication.
getSize()
Get the number of available (unacquired, non-delayed) jobs in the queue.
getAcquiredCount()
Get the number of acquired jobs (these are temporarily out of the queue).
doIsRootJobOldDuplicate(Job $job)
flushCaches()
Clear any process and persistent caches.
getAllDelayedJobs()
Get an iterator to traverse over all delayed jobs in this queue.
string $domain
DB domain ID.
supportedOrders()
Get the allowed queue orders for configuration validation.
getSiblingQueuesWithJobs(array $types)
Check whether each of the given queues are empty.
getRootJobCacheKey( $signature)
optimalOrder()
Get the default queue order to use if configuration does not specify one.
getDelayedCount()
Get the number of delayed jobs (these are temporarily out of the queue).
Class to both describe a background job and handle jobs.
returning false will NOT prevent logging $e
Job queue task description interface.
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))
This document describes the state of Postgres support in and is fairly well maintained The main code is very well while extensions are very hit and miss it is probably the most supported database after MySQL Much of the work in making MediaWiki database agnostic came about through the work of creating Postgres but without copying over all the usage comments General notes on the but these can almost always be programmed around *Although Postgres has a true BOOLEAN type
if(count( $args)< 1) $job