MediaWiki REL1_31
JobQueueSecondTestQueue.php
Go to the documentation of this file.
1<?php
2
19
23 private $mainQueue;
24
28 private $debugQueue;
29
34
35 protected function __construct( array $params ) {
36 if ( !isset( $params['mainqueue'] ) ) {
37 throw new MWException( "mainqueue parameter must be provided to the debug queue" );
38 }
39
40 if ( !isset( $params['debugqueue'] ) ) {
41 throw new MWException( "debugqueue parameter must be provided to the debug queue" );
42 }
43
44 $conf = [ 'wiki' => $params['wiki'], 'type' => $params['type'] ];
45 $this->mainQueue = JobQueue::factory( $params['mainqueue'] + $conf );
46 $this->debugQueue = JobQueue::factory( $params['debugqueue'] + $conf );
47 $this->onlyWriteToDebugQueue = isset( $params['readonly'] ) ? $params['readonly'] : false;
48
49 // We need to construct parent after creating the main and debug queue
50 // because super constructor calls some methods we delegate to the main queue.
51 parent::__construct( $params );
52 }
53
59 protected function supportedOrders() {
60 return $this->mainQueue->supportedOrders();
61 }
62
68 protected function optimalOrder() {
69 return $this->mainQueue->optimalOrder();
70 }
71
77 protected function supportsDelayedJobs() {
78 return $this->mainQueue->supportsDelayedJobs();
79 }
80
85 protected function doIsEmpty() {
86 return $this->mainQueue->doIsEmpty();
87 }
88
93 protected function doGetSize() {
94 return $this->mainQueue->doGetSize();
95 }
96
101 protected function doGetAcquiredCount() {
102 return $this->mainQueue->doGetAcquiredCount();
103 }
104
109 protected function doGetDelayedCount() {
110 return $this->mainQueue->doGetDelayedCount();
111 }
112
117 protected function doGetAbandonedCount() {
118 return $this->mainQueue->doGetAbandonedCount();
119 }
120
126 protected function doBatchPush( array $jobs, $flags ) {
127 if ( !$this->onlyWriteToDebugQueue ) {
128 $this->mainQueue->doBatchPush( $jobs, $flags );
129 }
130
131 try {
132 $this->debugQueue->doBatchPush( $jobs, $flags );
133 } catch ( Exception $exception ) {
134 MWExceptionHandler::logException( $exception );
135 }
136 }
137
142 protected function doPop() {
143 return $this->mainQueue->doPop();
144 }
145
151 protected function doAck( Job $job ) {
152 return $this->mainQueue->doAck( $job );
153 }
154
162 return $this->mainQueue->doDeduplicateRootJob( $job );
163 }
164
170 protected function doIsRootJobOldDuplicate( Job $job ) {
171 return $this->mainQueue->doIsRootJobOldDuplicate( $job );
172 }
173
178 protected function getRootJobCacheKey( $signature ) {
179 return $this->mainQueue->getRootJobCacheKey( $signature );
180 }
181
187 protected function doDelete() {
188 return $this->mainQueue->doDelete();
189 }
190
195 protected function doWaitForBackups() {
196 $this->mainQueue->doWaitForBackups();
197 }
198
203 protected function doFlushCaches() {
204 $this->mainQueue->doFlushCaches();
205 }
206
215 public function getAllQueuedJobs() {
216 return $this->mainQueue->getAllQueuedJobs();
217 }
218
227 public function getAllDelayedJobs() {
228 return $this->mainQueue->getAllDelayedJobs();
229 }
230
241 public function getAllAcquiredJobs() {
242 return $this->mainQueue->getAllAcquiredJobs();
243 }
244
252 public function getAllAbandonedJobs() {
253 return $this->mainQueue->getAllAbandonedJobs();
254 }
255
262 public function getCoalesceLocationInternal() {
263 return $this->mainQueue->getCoalesceLocationInternal();
264 }
265
271 protected function doGetSiblingQueuesWithJobs( array $types ) {
272 return $this->mainQueue->doGetSiblingQueuesWithJobs( $types );
273 }
274
280 protected function doGetSiblingQueueSizes( array $types ) {
281 return $this->mainQueue->doGetSiblingQueueSizes( $types );
282 }
283
287 protected function assertNotReadOnly() {
288 $this->mainQueue->assertNotReadOnly();
289 }
290}
A wrapper for the JobQueue that delegates all the method calls to a single, main queue,...
getAllAcquiredJobs()
Get an iterator to traverse over all claimed jobs in this queue.
doDeduplicateRootJob(IJobSpecification $job)
getAllDelayedJobs()
Get an iterator to traverse over all delayed jobs in this queue.
supportsDelayedJobs()
Find out if delayed jobs are supported for configuration validation.
getAllQueuedJobs()
Get an iterator to traverse over all available jobs in this queue.
getAllAbandonedJobs()
Get an iterator to traverse over all abandoned jobs in this queue.
getCoalesceLocationInternal()
Do not use this function outside of JobQueue/JobQueueGroup.
supportedOrders()
Get the allowed queue orders for configuration validation.
optimalOrder()
Get the default queue order to use if configuration does not specify one.
Class to handle enqueueing and running of background jobs.
Definition JobQueue.php:31
static factory(array $params)
Get a job queue object of the specified type.
Definition JobQueue.php:108
Class to both describe a background job and handle jobs.
Definition Job.php:31
MediaWiki exception.
Job queue task description interface.
if(count( $args)< 1) $job
$params