MediaWiki
REL1_23
|
Class to handle job queues stored in Redis. More...
Public Member Functions | |
__construct (array $params) | |
include: | |
getAllDelayedJobs () | |
getAllQueuedJobs () | |
getCoalesceLocationInternal () | |
Do not use this function outside of JobQueue/JobQueueGroup. | |
getJobFromUidInternal ($uid, RedisConnRef $conn) | |
This function should not be called outside JobQueueRedis. | |
recyclePruneAndUndelayJobs () | |
Recycle or destroy any jobs that have been claimed for too long and release any ready delayed jobs into the queue. | |
setTestingPrefix ($key) | |
Public Attributes | |
const | MAX_AGE_PRUNE = 604800 |
Protected Member Functions | |
doAck (Job $job) | |
doBatchPush (array $jobs, $flags) | |
doDeduplicateRootJob (Job $job) | |
doDelete () | |
doGetAbandonedCount () | |
doGetAcquiredCount () | |
doGetDelayedCount () | |
doGetPeriodicTasks () | |
doGetSiblingQueueSizes (array $types) | |
doGetSiblingQueuesWithJobs (array $types) | |
doGetSize () | |
doIsEmpty () | |
doIsRootJobOldDuplicate (Job $job) | |
doPop () | |
getConnection () | |
Get a connection to the server that handles all sub-queues for this queue. | |
getJobFromFields (array $fields) | |
getNewJobFields (IJobSpecification $job) | |
optimalOrder () | |
Get the default queue order to use if configuration does not specify one. | |
popAndAcquireBlob (RedisConnRef $conn) | |
popAndDeleteBlob (RedisConnRef $conn) | |
pushBlobs (RedisConnRef $conn, array $items) | |
serialize (array $fields) | |
supportedOrders () | |
Get the allowed queue orders for configuration validation. | |
supportsDelayedJobs () | |
Find out if delayed jobs are supported for configuration validation. | |
throwRedisException (RedisConnRef $conn, $e) | |
unserialize ($blob) | |
Protected Attributes | |
string | $compression |
Compression method to use *. | |
string | $key |
Key to prefix the queue keys with (used for testing) *. | |
null int | $maximumPeriodicTaskSeconds |
maximum seconds between execution of periodic tasks. | |
RedisConnectionPool | $redisPool |
* | |
string | $server |
Server address *. | |
Private Member Functions | |
getQueueKey ($prop, $type=null) |
Class to handle job queues stored in Redis.
This is faster, less resource intensive, queue that JobQueueDB. All data for a queue using this class is placed into one redis server.
There are eight main redis keys used to track jobs:
Additionally, "rootjob:* keys track "root jobs" used for additional de-duplication. Aside from root job keys, all keys have no expiry, and are only removed when jobs are run. All the keys are prefixed with the relevant wiki ID information.
This class requires Redis 2.6 as it makes use Lua scripts for fast atomic operations. Additionally, it should be noted that redis has different persistence modes, such as rdb snapshots, journaling, and no persistent. Appropriate configuration should be made on the servers based on what queues are using it and what tolerance they have.
Definition at line 59 of file JobQueueRedis.php.
JobQueueRedis::__construct | ( | array $ | params | ) |
include:
array | $params |
Reimplemented from JobQueue.
Definition at line 89 of file JobQueueRedis.php.
JobQueueRedis::doAck | ( | Job $ | job | ) | [protected] |
Job | $job |
MWException|JobQueueError |
Reimplemented from JobQueue.
Definition at line 420 of file JobQueueRedis.php.
JobQueueRedis::doBatchPush | ( | array $ | jobs, |
$ | flags | ||
) | [protected] |
array | $jobs | |
$flags |
JobQueueError |
Reimplemented from JobQueue.
Definition at line 196 of file JobQueueRedis.php.
JobQueueRedis::doDeduplicateRootJob | ( | Job $ | job | ) | [protected] |
Job | $job |
MWException|JobQueueError |
Reimplemented from JobQueue.
Definition at line 465 of file JobQueueRedis.php.
JobQueueRedis::doDelete | ( | ) | [protected] |
JobQueueError |
Reimplemented from JobQueue.
Definition at line 516 of file JobQueueRedis.php.
JobQueueRedis::doGetAbandonedCount | ( | ) | [protected] |
JobQueueError |
Reimplemented from JobQueue.
Definition at line 177 of file JobQueueRedis.php.
JobQueueRedis::doGetAcquiredCount | ( | ) | [protected] |
JobQueueError |
Reimplemented from JobQueue.
Definition at line 139 of file JobQueueRedis.php.
JobQueueRedis::doGetDelayedCount | ( | ) | [protected] |
JobQueueError |
Reimplemented from JobQueue.
Definition at line 160 of file JobQueueRedis.php.
JobQueueRedis::doGetPeriodicTasks | ( | ) | [protected] |
JobQueueRedis::doGetSiblingQueueSizes | ( | array $ | types | ) | [protected] |
array | $types | List of queues types |
Reimplemented from JobQueue.
Definition at line 587 of file JobQueueRedis.php.
JobQueueRedis::doGetSiblingQueuesWithJobs | ( | array $ | types | ) | [protected] |
array | $types | List of queues types |
Reimplemented from JobQueue.
Definition at line 583 of file JobQueueRedis.php.
References server.
JobQueueRedis::doGetSize | ( | ) | [protected] |
MWException |
Reimplemented from JobQueue.
Definition at line 125 of file JobQueueRedis.php.
JobQueueRedis::doIsEmpty | ( | ) | [protected] |
MWException |
Reimplemented from JobQueue.
Definition at line 116 of file JobQueueRedis.php.
JobQueueRedis::doIsRootJobOldDuplicate | ( | Job $ | job | ) | [protected] |
Job | $job |
JobQueueError |
Reimplemented from JobQueue.
Definition at line 493 of file JobQueueRedis.php.
JobQueueRedis::doPop | ( | ) | [protected] |
JobQueueError |
Reimplemented from JobQueue.
Definition at line 304 of file JobQueueRedis.php.
Reimplemented from JobQueue.
Definition at line 560 of file JobQueueRedis.php.
References array(), and getConnection().
Reimplemented from JobQueue.
Definition at line 537 of file JobQueueRedis.php.
References array(), getConnection(), and throwRedisException().
Do not use this function outside of JobQueue/JobQueueGroup.
Reimplemented from JobQueue.
Definition at line 579 of file JobQueueRedis.php.
JobQueueRedis::getConnection | ( | ) | [protected] |
Get a connection to the server that handles all sub-queues for this queue.
JobQueueConnectionError |
Definition at line 828 of file JobQueueRedis.php.
Referenced by getAllDelayedJobs(), and getAllQueuedJobs().
JobQueueRedis::getJobFromFields | ( | array $ | fields | ) | [protected] |
$fields | array |
Definition at line 774 of file JobQueueRedis.php.
References $job, $title, JobQueue\factory(), and Title\makeTitleSafe().
JobQueueRedis::getJobFromUidInternal | ( | $ | uid, |
RedisConnRef $ | conn | ||
) |
This function should not be called outside JobQueueRedis.
$uid | string |
$conn | RedisConnRef |
MWException|JobQueueError |
Definition at line 617 of file JobQueueRedis.php.
JobQueueRedis::getNewJobFields | ( | IJobSpecification $ | job | ) | [protected] |
IJobSpecification | $job |
Definition at line 752 of file JobQueueRedis.php.
References array(), IJobSpecification\getDeduplicationInfo(), IJobSpecification\getParams(), IJobSpecification\getReleaseTimestamp(), IJobSpecification\getTitle(), IJobSpecification\getType(), IJobSpecification\ignoreDuplicates(), UIDGenerator\newRawUUIDv4(), UIDGenerator\QUICK_RAND, serialize(), and wfBaseConvert().
JobQueueRedis::getQueueKey | ( | $ | prop, |
$ | type = null |
||
) | [private] |
$prop | string |
$type | string|null |
Definition at line 852 of file JobQueueRedis.php.
JobQueueRedis::optimalOrder | ( | ) | [protected] |
Get the default queue order to use if configuration does not specify one.
Reimplemented from JobQueue.
Definition at line 103 of file JobQueueRedis.php.
References array().
JobQueueRedis::popAndAcquireBlob | ( | RedisConnRef $ | conn | ) | [protected] |
RedisConnRef | $conn |
RedisException |
Definition at line 384 of file JobQueueRedis.php.
JobQueueRedis::popAndDeleteBlob | ( | RedisConnRef $ | conn | ) | [protected] |
RedisConnRef | $conn |
RedisException |
Definition at line 351 of file JobQueueRedis.php.
JobQueueRedis::pushBlobs | ( | RedisConnRef $ | conn, |
array $ | items | ||
) | [protected] |
RedisConnRef | $conn | |
array | $items | List of results from JobQueueRedis::getNewJobFields() |
RedisException |
Definition at line 251 of file JobQueueRedis.php.
Recycle or destroy any jobs that have been claimed for too long and release any ready delayed jobs into the queue.
MWException|JobQueueError |
Definition at line 644 of file JobQueueRedis.php.
JobQueueRedis::serialize | ( | array $ | fields | ) | [protected] |
array | $fields |
Definition at line 790 of file JobQueueRedis.php.
References $blob, array(), and object.
Referenced by getNewJobFields().
JobQueueRedis::setTestingPrefix | ( | $ | key | ) |
$key | string |
Reimplemented from JobQueue.
Definition at line 866 of file JobQueueRedis.php.
JobQueueRedis::supportedOrders | ( | ) | [protected] |
Get the allowed queue orders for configuration validation.
Reimplemented from JobQueue.
Definition at line 99 of file JobQueueRedis.php.
JobQueueRedis::supportsDelayedJobs | ( | ) | [protected] |
Find out if delayed jobs are supported for configuration validation.
Reimplemented from JobQueue.
Definition at line 107 of file JobQueueRedis.php.
JobQueueRedis::throwRedisException | ( | RedisConnRef $ | conn, |
$ | e | ||
) | [protected] |
$conn | RedisConnRef |
$e | RedisException |
JobQueueError |
Definition at line 842 of file JobQueueRedis.php.
Referenced by getAllQueuedJobs().
JobQueueRedis::unserialize | ( | $ | blob | ) | [protected] |
string | $blob |
Definition at line 809 of file JobQueueRedis.php.
References $blob.
string JobQueueRedis::$compression [protected] |
Compression method to use *.
Definition at line 64 of file JobQueueRedis.php.
string JobQueueRedis::$key [protected] |
Key to prefix the queue keys with (used for testing) *.
Definition at line 68 of file JobQueueRedis.php.
Referenced by setTestingPrefix().
null int JobQueueRedis::$maximumPeriodicTaskSeconds [protected] |
maximum seconds between execution of periodic tasks.
Used to speed up testing but should otherwise be left unset.
Definition at line 73 of file JobQueueRedis.php.
RedisConnectionPool JobQueueRedis::$redisPool [protected] |
*
Definition at line 60 of file JobQueueRedis.php.
string JobQueueRedis::$server [protected] |
Server address *.
Definition at line 62 of file JobQueueRedis.php.
const JobQueueRedis::MAX_AGE_PRUNE = 604800 |
Definition at line 66 of file JobQueueRedis.php.