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 ) {