38 parent::__construct( $params );
50 foreach ( $jobs as
$job ) {
51 if (
$job->ignoreDuplicates() ) {
53 if ( !isset( $unclaimed[$sha1] ) ) {
54 $unclaimed[$sha1] =
$job;
68 return [
'random',
'timestamp',
'fifo' ];
97 return $unclaimed ? count( $unclaimed ) : 0;
108 return $claimed ? count( $claimed ) : 0;
124 if ( $this->order ===
'random' ) {
125 $key = array_rand( $unclaimed );
128 $key = key( $unclaimed );
131 $spec = $unclaimed[$key];
132 unset( $unclaimed[$key] );
138 $job->setMetadata(
'claimId', key( $claimed ) );
154 unset( $claimed[
$job->getMetadata(
'claimId' )] );
161 if ( isset( self::$data[$this->type][$this->domain] ) ) {
162 unset( self::$data[$this->type][$this->domain] );
163 if ( !self::$data[$this->type] ) {
164 unset( self::$data[$this->type] );
177 return new ArrayIterator( [] );
182 function ( $value ) {
196 return new ArrayIterator( [] );
201 function ( $value ) {
222 if ( !isset( self::$data[$this->type][$this->domain][$field] ) ) {
223 if ( $init !==
null ) {
Simple store for keeping values in an associative array for the current process.
Class to handle job queues stored in PHP memory for testing.
doDelete()
Stable to override.JobQueue::delete()
__construct(array $params)
Stable to call.
& getQueueData( $field, $init=null)
doBatchPush(array $jobs, $flags)
jobFromSpecInternal(IJobSpecification $spec)
Class to handle enqueueing and running of background jobs.
factoryJob( $command, $params)
getAcquiredCount()
Get the number of acquired jobs (these are temporarily out of the queue).
string $domain
DB domain ID.
Convenience class for generating iterators from iterators.
Multi-datacenter aware caching interface.
Interface for serializable objects that describe a job queue task.
Job that has a run() method and metadata accessors for JobQueue::pop() and JobQueue::ack()
if(count( $args)< 1) $job